This commit is contained in:
Daniil
2026-04-07 13:42:45 +03:00
parent 7d2f444e1c
commit 259d3da89f
34 changed files with 2130 additions and 788 deletions
+9 -9
View File
@@ -53,10 +53,10 @@ async def retrieve_job_endpoint(
service = JobService(db)
job = await service.get_job(job_id)
if job is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
if not current_user.is_staff and job.user_id != current_user.id:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Доступ запрещён")
return JobRead.model_validate(job)
@@ -71,10 +71,10 @@ async def patch_job_endpoint(
service = JobService(db)
job = await service.get_job(job_id)
if job is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
if not current_user.is_staff and job.user_id != current_user.id:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Доступ запрещён")
if body.status == "CANCELLED":
task_service = TaskService(db)
@@ -94,10 +94,10 @@ async def delete_job_endpoint(
service = JobService(db)
job = await service.get_job(job_id)
if job is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
if not current_user.is_staff and job.user_id != current_user.id:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Доступ запрещён")
await service.deactivate_job(job)
return Response(status_code=status.HTTP_204_NO_CONTENT)
@@ -136,7 +136,7 @@ async def retrieve_event_endpoint(
service = JobService(db)
event = await service.get_job_event(event_id)
if event is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
return JobEventRead.model_validate(event)
@@ -152,7 +152,7 @@ async def patch_event_endpoint(
service = JobService(db)
event = await service.get_job_event(event_id)
if event is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
event = await service.update_job_event(event, body)
return JobEventRead.model_validate(event)
@@ -168,7 +168,7 @@ async def delete_event_endpoint(
service = JobService(db)
event = await service.get_job_event(event_id)
if event is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Не найдено")
await service.deactivate_job_event(event)
return Response(status_code=status.HTTP_204_NO_CONTENT)