fix: cards reorder fixed

This commit is contained in:
2025-06-23 16:57:50 +04:00
parent 2bec0c579f
commit d4d25b4df5
3 changed files with 7 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ async def get_summary(
@card_router.post(
'/summaries/reorder',
response_model=CardSummaryResponse,
response_model=ReorderResponse,
operation_id='reorderCardSummaries',
dependencies=[Depends(authorized_user)]
)

View File

@@ -360,6 +360,10 @@ class CardSummaryResponse(BaseSchema):
pagination_info: PaginationInfoSchema
class ReorderResponse(OkMessageSchema):
pass
class CardAddServicesResponse(BaseSchema):
ok: bool
message: str

View File

@@ -491,7 +491,7 @@ class CardsService(BaseService):
await self.session.commit()
return UpdateCardClientResponse(ok=True, message='Данные карточки успешно обновлены')
async def reorder(self, request: CardSummaryReorderRequest, user: User) -> CardSummaryResponse:
async def reorder(self, request: CardSummaryReorderRequest, user: User) -> ReorderResponse:
card: Card = await self.session.scalar(select(Card).where(Card.id == request.card_id))
if request.index == 1:
request.index = 0
@@ -535,7 +535,7 @@ class CardsService(BaseService):
comment=request.comment,
rank=str(new_rank))
await self.session.commit()
return await self.get_summary()
return ReorderResponse(ok=True, message="Изменения сохранены")
async def add_kit_to_card(self, request: CardAddKitRequest) -> CardAddKitResponse:
try: