fix: cards reorder fixed
This commit is contained in:
@@ -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)]
|
||||
)
|
||||
|
||||
@@ -360,6 +360,10 @@ class CardSummaryResponse(BaseSchema):
|
||||
pagination_info: PaginationInfoSchema
|
||||
|
||||
|
||||
class ReorderResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardAddServicesResponse(BaseSchema):
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user