правки
This commit is contained in:
@@ -425,7 +425,7 @@ class Postgres(DatabaseBase):
|
||||
|
||||
return (
|
||||
await query.prefetch_related('project', 'project__channel', 'channel', 'creative')
|
||||
.order_by('-created_at')
|
||||
.order_by('-placement_at', '-created_at')
|
||||
.all()
|
||||
)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
from fastapi.routing import APIRouter
|
||||
from fastapi_pagination import Page, paginate
|
||||
|
||||
from src import deps, dto
|
||||
from src.adapter.jwt import JWTPayload
|
||||
@@ -35,7 +36,7 @@ async def get_placements(
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
current_user: Annotated[JWTPayload, Depends(deps.get_current_user)],
|
||||
) -> dto.GetPlacementsOutput:
|
||||
) -> Page[dto.PlacementWithPostsOutput]:
|
||||
"""Get all placements for a project"""
|
||||
input = dto.GetPlacementsInput(
|
||||
user_id=current_user.user_id,
|
||||
@@ -43,7 +44,7 @@ async def get_placements(
|
||||
project_id=project_id,
|
||||
)
|
||||
result = await deps.get_usecase().get_placements(input=input)
|
||||
return result
|
||||
return paginate(result.placements) # type: ignore[no-any-return]
|
||||
|
||||
|
||||
@placements_user_router.get('/{placement_id}')
|
||||
|
||||
Reference in New Issue
Block a user