mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-18 05:09:29 +00:00
fix: correct openapi schema for decks
This commit is contained in:
12437
pnpm-lock.yaml
generated
12437
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -37,12 +37,7 @@ import { Card, CardWithGrade, PaginatedCardsWithGrade } from '../cards/entities/
|
|||||||
|
|
||||||
import { CreateDeckDto, GetAllDecksDto, UpdateDeckDto } from './dto'
|
import { CreateDeckDto, GetAllDecksDto, UpdateDeckDto } from './dto'
|
||||||
import { GetRandomCardDto } from './dto/get-random-card.dto'
|
import { GetRandomCardDto } from './dto/get-random-card.dto'
|
||||||
import {
|
import { Deck, PaginatedDecks, PaginatedDecksWithMaxCardsCount } from './entities/deck.entity'
|
||||||
Deck,
|
|
||||||
DeckWithAuthor,
|
|
||||||
PaginatedDecks,
|
|
||||||
PaginatedDecksWithMaxCardsCount,
|
|
||||||
} from './entities/deck.entity'
|
|
||||||
import { MinMaxCards } from './entities/min-max-cards.entity'
|
import { MinMaxCards } from './entities/min-max-cards.entity'
|
||||||
import {
|
import {
|
||||||
CreateCardCommand,
|
CreateCardCommand,
|
||||||
@@ -120,7 +115,7 @@ export class DecksController {
|
|||||||
cover: Express.Multer.File[]
|
cover: Express.Multer.File[]
|
||||||
},
|
},
|
||||||
@Body() createDeckDto: CreateDeckDto
|
@Body() createDeckDto: CreateDeckDto
|
||||||
): Promise<DeckWithAuthor> {
|
): Promise<Deck> {
|
||||||
const userId = req.user.id
|
const userId = req.user.id
|
||||||
|
|
||||||
return this.commandBus.execute(
|
return this.commandBus.execute(
|
||||||
@@ -133,7 +128,7 @@ export class DecksController {
|
|||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
findOne(@Param('id') id: string): Promise<DeckWithAuthor> {
|
findOne(@Param('id') id: string): Promise<Deck> {
|
||||||
return this.commandBus.execute(new GetDeckByIdCommand(id))
|
return this.commandBus.execute(new GetDeckByIdCommand(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +148,7 @@ export class DecksController {
|
|||||||
},
|
},
|
||||||
@Body() updateDeckDto: UpdateDeckDto,
|
@Body() updateDeckDto: UpdateDeckDto,
|
||||||
@Req() req
|
@Req() req
|
||||||
): Promise<DeckWithAuthor> {
|
): Promise<Deck> {
|
||||||
return this.commandBus.execute(
|
return this.commandBus.execute(
|
||||||
new UpdateDeckCommand(id, updateDeckDto, req.user.id, files?.cover?.[0])
|
new UpdateDeckCommand(id, updateDeckDto, req.user.id, files?.cover?.[0])
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ LIMIT $${conditions.length + havingConditions.length + 1} OFFSET $${
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return { ...result, cardsCount: result._count.card }
|
return omit({ ...result, cardsCount: result._count.card }, ['_count'])
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(e?.message)
|
this.logger.error(e?.message)
|
||||||
throw new InternalServerErrorException(e?.message)
|
throw new InternalServerErrorException(e?.message)
|
||||||
|
|||||||
Reference in New Issue
Block a user