fix: cards reorder fixed
This commit is contained in:
@@ -94,7 +94,7 @@ async def get_summary(
|
|||||||
|
|
||||||
@card_router.post(
|
@card_router.post(
|
||||||
'/summaries/reorder',
|
'/summaries/reorder',
|
||||||
response_model=CardSummaryResponse,
|
response_model=ReorderResponse,
|
||||||
operation_id='reorderCardSummaries',
|
operation_id='reorderCardSummaries',
|
||||||
dependencies=[Depends(authorized_user)]
|
dependencies=[Depends(authorized_user)]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -360,6 +360,10 @@ class CardSummaryResponse(BaseSchema):
|
|||||||
pagination_info: PaginationInfoSchema
|
pagination_info: PaginationInfoSchema
|
||||||
|
|
||||||
|
|
||||||
|
class ReorderResponse(OkMessageSchema):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CardAddServicesResponse(BaseSchema):
|
class CardAddServicesResponse(BaseSchema):
|
||||||
ok: bool
|
ok: bool
|
||||||
message: str
|
message: str
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ class CardsService(BaseService):
|
|||||||
await self.session.commit()
|
await self.session.commit()
|
||||||
return UpdateCardClientResponse(ok=True, message='Данные карточки успешно обновлены')
|
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))
|
card: Card = await self.session.scalar(select(Card).where(Card.id == request.card_id))
|
||||||
if request.index == 1:
|
if request.index == 1:
|
||||||
request.index = 0
|
request.index = 0
|
||||||
@@ -535,7 +535,7 @@ class CardsService(BaseService):
|
|||||||
comment=request.comment,
|
comment=request.comment,
|
||||||
rank=str(new_rank))
|
rank=str(new_rank))
|
||||||
await self.session.commit()
|
await self.session.commit()
|
||||||
return await self.get_summary()
|
return ReorderResponse(ok=True, message="Изменения сохранены")
|
||||||
|
|
||||||
async def add_kit_to_card(self, request: CardAddKitRequest) -> CardAddKitResponse:
|
async def add_kit_to_card(self, request: CardAddKitRequest) -> CardAddKitResponse:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user