aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/encora/ToDosRepository.java
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-25 13:23:16 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-25 13:23:16 -0600
commit45ab8b99bf27e3923331d2d640463b65ee7ad818 (patch)
tree418334a8928192c3e585b45c08e01bc886bf5bbc /src/main/java/com/encora/ToDosRepository.java
parent0092d821aeca201321fd87b704ef0ad674f0d95b (diff)
downloadToDo-App-BE-45ab8b99bf27e3923331d2d640463b65ee7ad818.tar.gz
ToDo-App-BE-45ab8b99bf27e3923331d2d640463b65ee7ad818.zip
Added a POST endpoint.
Submit a JSON formatted body with the values "text", "dueDate" and "priority" to submit a new to do.
Diffstat (limited to 'src/main/java/com/encora/ToDosRepository.java')
-rw-r--r--src/main/java/com/encora/ToDosRepository.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/com/encora/ToDosRepository.java b/src/main/java/com/encora/ToDosRepository.java
index 029185b..c979e11 100644
--- a/src/main/java/com/encora/ToDosRepository.java
+++ b/src/main/java/com/encora/ToDosRepository.java
@@ -38,6 +38,14 @@ public class ToDosRepository implements JpaRepository<ToDos, Integer> {
return this.todos;
}
+ // Save new element.
+ @Override
+ public <S extends ToDos> S save(S entity) {
+ entity.setId(++this.lastId);
+ this.todos.add(entity);
+ return null;
+ }
+
/*
* N O T Y E T D E F I N E D .
*/
@@ -122,11 +130,6 @@ public class ToDosRepository implements JpaRepository<ToDos, Integer> {
}
@Override
- public <S extends ToDos> S save(S entity) {
- return null;
- }
-
- @Override
public <S extends ToDos> List<S> saveAll(Iterable<S> entities) {
return null;
}