Skip to content

Commit

Permalink
Update response model to TaskStatusResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj0517 committed Dec 7, 2024
1 parent 20190e7 commit eee8422
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/routers/task/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
from backend.db.task.models import (
TasksResult,
Task,
TaskStatusResponse,
TaskType
)
from backend.common.models import (
Response,
Result,
TaskStatusResponse
)
from backend.common.compresser import compress_files, find_file_by_hash
from modules.utils.paths import BACKEND_CACHE_DIR
Expand All @@ -27,22 +27,22 @@

@task_router.get(
"/{identifier}",
response_model=Task,
response_model=TaskStatusResponse,
status_code=status.HTTP_200_OK,
summary="Retrieve Task by Identifier",
description="Retrieve the specific task by its identifier.",
)
async def get_task(
identifier: str,
session: Session = Depends(get_db_session),
) -> Task:
) -> TaskStatusResponse:
"""
Retrieve the specific task by its identifier.
"""
task = get_task_status_from_db(identifier=identifier, session=session)

if task is not None:
return task.to_status_response()
return task.to_response()
else:
raise HTTPException(status_code=404, detail="Identifier not found")

Expand Down

0 comments on commit eee8422

Please sign in to comment.