aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/encora/Main.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/encora/Main.java b/src/main/java/com/encora/Main.java
index a233550..47d72c0 100644
--- a/src/main/java/com/encora/Main.java
+++ b/src/main/java/com/encora/Main.java
@@ -27,6 +27,7 @@ public class Main {
SpringApplication.run(Main.class, args);
}
+
// Get all to dos.
@GetMapping("/todos")
@ResponseStatus(value=HttpStatus.OK)
@@ -34,6 +35,7 @@ public class Main {
return toDosRepository.findAll();
}
+
// Add a new to do.
@ResponseStatus(value=HttpStatus.BAD_REQUEST, reason="Text is longer than 120 characters.")
public static class longerThanMaxException extends RuntimeException {}
@@ -57,6 +59,7 @@ public class Main {
toDosRepository.save(todo);
}
+
// Updates to do with new information
@ResponseStatus(value=HttpStatus.BAD_REQUEST, reason="No to do with such index.")
public static class toDoNotFound extends RuntimeException {}
@@ -77,7 +80,6 @@ public class Main {
// Update a to do with "done".
-
@PostMapping("/todos/{id}/done")
@ResponseStatus(value=HttpStatus.OK)
public void setDone(@PathVariable("id") Integer id) {
@@ -90,6 +92,7 @@ public class Main {
toDosRepository.save(selectedToDo);
}
+
// Update a to do to set "done" as false.
@PutMapping("/todos/{id}/undone")
@ResponseStatus(value=HttpStatus.OK)