Skip to content

Commit

Permalink
refactor: task status update endpoint to adjust mapper role (#1180)
Browse files Browse the repository at this point in the history
* update: task status update endpoint to adjust mapper role

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
nrjadkry and pre-commit-ci[bot] authored Feb 7, 2024
1 parent 636ce3e commit 9cbc5b9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/backend/app/tasks/tasks_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
from sqlalchemy.sql import text

from app.auth.osm import AuthUser
from app.auth.roles import mapper, project_admin
from app.auth.roles import get_uid, mapper, project_admin
from app.central import central_crud
from app.db import database
from app.models.enums import TaskStatus
from app.projects import project_crud, project_schemas
from app.tasks import tasks_crud, tasks_schemas
from app.users import user_schemas

router = APIRouter(
prefix="/tasks",
Expand Down Expand Up @@ -123,15 +122,13 @@ async def get_specific_task(task_id: int, db: Session = Depends(database.get_db)
"/{task_id}/new_status/{new_status}", response_model=tasks_schemas.ReadTask
)
async def update_task_status(
user: user_schemas.User,
task_id: int,
new_status: TaskStatus,
db: Session = Depends(database.get_db),
current_user: AuthUser = Depends(mapper),
):
"""Update the task status."""
user_id = user.id

user_id = get_uid(current_user)
task = await tasks_crud.update_task_status(db, user_id, task_id, new_status)
updated_task = await tasks_crud.update_task_history(task, db)
if not task:
Expand Down

0 comments on commit 9cbc5b9

Please sign in to comment.