feat: work shift pauses

This commit is contained in:
2024-12-04 11:00:00 +04:00
parent 2bd2486653
commit 9a6fc3fdd7
5 changed files with 316 additions and 72 deletions

View File

@@ -47,7 +47,7 @@ async def finish_shift(
user_id: int,
user: CurrentUserDependency,
):
return await WorkShiftsService(session).finish_shift(user, user_id)
return await WorkShiftsService(session).finish_shift_by_user_id(user, user_id)
@work_shifts_router.post(
@@ -86,3 +86,51 @@ async def delete_work_shift(
shift_id: int,
):
return await WorkShiftsService(session).delete_shift(shift_id)
@work_shifts_router.post(
"/pause/start/{shift_id}",
response_model=StartPauseByShiftIdResponse,
operation_id="start_pause_by_shift_id",
)
async def start_pause_by_shift_id(
session: SessionDependency,
shift_id: int,
):
return await WorkShiftsService(session).start_pause_by_shift_id(shift_id)
@work_shifts_router.post(
"/pause/start/for-user/{user_id}",
response_model=StartPauseByUserIdResponse,
operation_id="start_pause_by_user_id",
)
async def start_pause_by_user_id(
session: SessionDependency,
user_id: int,
):
return await WorkShiftsService(session).start_pause_by_user_id(user_id)
@work_shifts_router.post(
"/pause/finish/{shift_id}",
response_model=FinishPauseByShiftIdResponse,
operation_id="finish_pause_by_shift_id",
)
async def finish_pause_by_shift_id(
session: SessionDependency,
shift_id: int,
):
return await WorkShiftsService(session).finish_pause_by_shift_id(shift_id)
@work_shifts_router.post(
"/pause/finish/for-user/{shift_id}",
response_model=FinishPauseByUserIdResponse,
operation_id="finish_pause_by_user_id",
)
async def finish_pause_by_user_id(
session: SessionDependency,
user_id: int,
):
return await WorkShiftsService(session).finish_pause_by_user_id(user_id)