Reorder routes in order to get working CORS

This commit is contained in:
ziajka 2018-11-08 11:47:09 +01:00
parent fcd102317a
commit 41fbbf7a56

View File

@ -92,21 +92,6 @@ class ProjectHandler:
project = controller.get_project(request.match_info["project_id"]) project = controller.get_project(request.match_info["project_id"])
response.json(project) response.json(project)
@Route.get(
r"/projects/{project_id}/stats",
description="Get a project statistics",
parameters={
"project_id": "Project UUID",
},
status_codes={
200: "Project statistics returned",
404: "The project doesn't exist"
})
def get(request, response):
controller = Controller.instance()
project = controller.get_project(request.match_info["project_id"])
response.json(project.stats())
@Route.put( @Route.put(
r"/projects/{project_id}", r"/projects/{project_id}",
status_codes={ status_codes={
@ -127,6 +112,39 @@ class ProjectHandler:
response.set_status(200) response.set_status(200)
response.json(project) response.json(project)
@Route.delete(
r"/projects/{project_id}",
description="Delete a project from disk",
parameters={
"project_id": "Project UUID",
},
status_codes={
204: "Changes have been written on disk",
404: "The project doesn't exist"
})
async def delete(request, response):
controller = Controller.instance()
project = controller.get_project(request.match_info["project_id"])
await project.delete()
controller.remove_project(project)
response.set_status(204)
@Route.get(
r"/projects/{project_id}/stats",
description="Get a project statistics",
parameters={
"project_id": "Project UUID",
},
status_codes={
200: "Project statistics returned",
404: "The project doesn't exist"
})
def get(request, response):
controller = Controller.instance()
project = controller.get_project(request.match_info["project_id"])
response.json(project.stats())
@Route.post( @Route.post(
r"/projects/{project_id}/close", r"/projects/{project_id}/close",
description="Close a project", description="Close a project",
@ -189,24 +207,6 @@ class ProjectHandler:
response.set_status(201) response.set_status(201)
response.json(project) response.json(project)
@Route.delete(
r"/projects/{project_id}",
description="Delete a project from disk",
parameters={
"project_id": "Project UUID",
},
status_codes={
204: "Changes have been written on disk",
404: "The project doesn't exist"
})
async def delete(request, response):
controller = Controller.instance()
project = controller.get_project(request.match_info["project_id"])
await project.delete()
controller.remove_project(project)
response.set_status(204)
@Route.get( @Route.get(
r"/projects/{project_id}/notifications", r"/projects/{project_id}/notifications",
description="Receive notifications about projects", description="Receive notifications about projects",