add to tasks service
This commit is contained in:
@@ -36,7 +36,9 @@ class Date(BaseModel):
|
||||
@model_validator(mode="after")
|
||||
def check_dates(self):
|
||||
if self.date_from and self.date_to and self.date_to < self.date_from:
|
||||
raise HTTPException(status_code=422, detail="date_to cannot be less than date_from")
|
||||
raise HTTPException(
|
||||
status_code=422, detail="date_to cannot be less than date_from"
|
||||
)
|
||||
return self
|
||||
|
||||
|
||||
|
||||
@@ -18,9 +18,16 @@ async def get_tasks(
|
||||
user: ActiveUser,
|
||||
page: PaginationTasksDep,
|
||||
status: StatusTaskDep,
|
||||
date: DateDep,
|
||||
date_filter: DateDep,
|
||||
):
|
||||
result = await UserService(session).get_user_with_tasks(user.id)
|
||||
result = await UserService(session).get_user_with_tasks(
|
||||
user_id=user.id,
|
||||
status=status.status,
|
||||
limit=page.limit,
|
||||
offset=page.page,
|
||||
date_to=date_filter.date_to,
|
||||
date_from=date_filter.date_from,
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user