EOD
This commit is contained in:
parent
3943528d2c
commit
88a3b9f669
@ -38,10 +38,12 @@ public class Server {
|
|||||||
post("/create", (req, res) -> {
|
post("/create", (req, res) -> {
|
||||||
checkAuth(req);
|
checkAuth(req);
|
||||||
|
|
||||||
ToDoList toDoList = new ToDoList();
|
res.type("application/json");
|
||||||
|
|
||||||
|
ToDoList toDoList = new ToDoList(ToDoListManager.getLastIndex(), req.headers("Authorization").split(" ")[1]);
|
||||||
toDoList.setId(ToDoListManager.getLastIndex());
|
toDoList.setId(ToDoListManager.getLastIndex());
|
||||||
|
|
||||||
return "Create To Do List";
|
return toDoList.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
post("/create/:listId/:itemId", (req, res) -> {
|
post("/create/:listId/:itemId", (req, res) -> {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package tech.nevets.todoserver;
|
package tech.nevets.todoserver;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ToDoList {
|
public class ToDoList {
|
||||||
@ -9,6 +11,11 @@ public class ToDoList {
|
|||||||
|
|
||||||
public ToDoList() {}
|
public ToDoList() {}
|
||||||
|
|
||||||
|
public ToDoList(int id, String ownerAuthKey) {
|
||||||
|
this.id = id;
|
||||||
|
this.ownerAuthKey = ownerAuthKey;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -32,4 +39,9 @@ public class ToDoList {
|
|||||||
public void setToDoItems(List<ToDoItem> toDoItems) {
|
public void setToDoItems(List<ToDoItem> toDoItems) {
|
||||||
this.toDoItems = toDoItems;
|
this.toDoItems = toDoItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new Gson().toJson(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user