правки

This commit is contained in:
Artem Tsyrulnikov
2026-02-01 14:36:09 +03:00
parent b212b6c22f
commit a92f33c22f
10 changed files with 235 additions and 43 deletions

View File

@@ -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()
)

View File

@@ -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}')