mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 05:09:26 +00:00
fix pagination and create pagination service
This commit is contained in:
@@ -26,8 +26,9 @@ import {
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'
|
||||
import { GetAllDecksDto } from './dto/get-all-decks.dto'
|
||||
import { GetAllCardsInDeckDto } from '../cards/dto/get-all-cards.dto'
|
||||
import { CreateCardCommand } from './use-cases/create-card-use-case'
|
||||
import { CreateCardCommand } from './use-cases'
|
||||
import { CreateCardDto } from '../cards/dto/create-card.dto'
|
||||
import { Pagination } from '../../infrastructure/common/pagination/pagination.service'
|
||||
|
||||
@Controller('decks')
|
||||
export class DecksController {
|
||||
@@ -43,7 +44,8 @@ export class DecksController {
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
findAll(@Query() query: GetAllDecksDto, @Req() req) {
|
||||
return this.commandBus.execute(new GetAllDecksCommand({ ...query, userId: req.user.id }))
|
||||
const finalQuery = Pagination.getPaginationData(query)
|
||||
return this.commandBus.execute(new GetAllDecksCommand({ ...finalQuery, userId: req.user.id }))
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
|
||||
Reference in New Issue
Block a user