Skip to content

Commit

Permalink
update: project_id and task_id moved to the url params
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Jul 8, 2024
1 parent 5783e9d commit 6050b19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
24 changes: 13 additions & 11 deletions src/backend/app/tasks/task_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ async def task_states(
return await task_crud.all_tasks_states(db, project_id)


@router.post("/update-event/")
@router.post("/event/{project_id}/{task_id}")
async def new_event(
project_id: uuid.UUID,
task_id: uuid.UUID,
detail: task_schemas.NewEvent,
user_data: AuthUser = Depends(login_required),
db: Database = Depends(database.encode_db),
Expand All @@ -37,16 +39,16 @@ async def new_event(
case EventType.MAP:
return await task_crud.map_task(
db,
detail.project_id,
detail.task_id,
project_id,
task_id,
user_id,
"Done: locked for mapping",
)
case EventType.FINISH:
return await task_crud.update_task_state(
db,
detail.project_id,
detail.task_id,
project_id,
task_id,
user_id,
"Done: unlocked to validate",
State.LOCKED_FOR_MAPPING,
Expand All @@ -55,8 +57,8 @@ async def new_event(
case EventType.VALIDATE:
return await task_crud.update_task_state(
db,
detail.project_id,
detail.task_id,
project_id,
task_id,
user_id,
"Done: locked for validation",
State.UNLOCKED_TO_VALIDATE,
Expand All @@ -65,8 +67,8 @@ async def new_event(
case EventType.GOOD:
return await task_crud.update_task_state(
db,
detail.project_id,
detail.task_id,
project_id,
task_id,
user_id,
"Done: Task is Good",
State.LOCKED_FOR_VALIDATION,
Expand All @@ -76,8 +78,8 @@ async def new_event(
case EventType.BAD:
return await task_crud.update_task_state(
db,
detail.project_id,
detail.task_id,
project_id,
task_id,
user_id,
"Done: needs to redo",
State.LOCKED_FOR_VALIDATION,
Expand Down
3 changes: 0 additions & 3 deletions src/backend/app/tasks/task_schemas.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import uuid
from pydantic import BaseModel
from app.models.enums import EventType


class NewEvent(BaseModel):
event: EventType
project_id: uuid.UUID
task_id: uuid.UUID

0 comments on commit 6050b19

Please sign in to comment.