-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.py
More file actions
37 lines (25 loc) · 903 Bytes
/
views.py
File metadata and controls
37 lines (25 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from flask import Blueprint, request
from . import list_service
lists = Blueprint("list_controller", __name__)
@lists.route("", methods=["POST"])
def createList():
request_json = request.json
response = list_service.create_task_list(request_json)
return response
@lists.route("", methods=["GET"])
def getAllLists():
return list_service.get_all_lists()
@lists.route("<list_id>", methods=["DELETE"])
def deleteList(list_id):
response = list_service.delete_task_list(list_id)
return response
@lists.route("<list_id>/tasks", methods=["POST"])
def createTaskInList(list_id):
request_json = request.json
request_json["list_id"] = list_id
response = list_service.create_task(request_json)
return response
@lists.route("<list_id>/tasks", methods=["GET"])
def getAllTasksFromList(list_id):
response = list_service.getListTasks(list_id)
return response