mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-16 20:59:26 +00:00
fix orderBy not allowing null
This commit is contained in:
@@ -25,7 +25,6 @@ import {
|
||||
|
||||
import { JwtAuthGuard } from '../auth/guards'
|
||||
|
||||
import { CardsService } from './cards.service'
|
||||
import { UpdateCardDto } from './dto'
|
||||
import { Card } from './entities/cards.entity'
|
||||
import { DeleteCardByIdCommand, GetDeckByIdCommand, UpdateCardCommand } from './use-cases'
|
||||
@@ -33,7 +32,7 @@ import { DeleteCardByIdCommand, GetDeckByIdCommand, UpdateCardCommand } from './
|
||||
@ApiTags('Cards')
|
||||
@Controller('cards')
|
||||
export class CardsController {
|
||||
constructor(private readonly decksService: CardsService, private commandBus: CommandBus) {}
|
||||
constructor(private commandBus: CommandBus) {}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiOperation({ summary: 'Get card by id', description: 'Get card by id' })
|
||||
|
||||
@@ -65,7 +65,7 @@ export class CardsRepository {
|
||||
orderBy,
|
||||
}: GetAllCardsInDeckDto
|
||||
): Promise<PaginatedCardsWithGrade> {
|
||||
if (!orderBy) {
|
||||
if (!orderBy || orderBy === 'null') {
|
||||
orderBy = 'updated-desc'
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -33,7 +33,6 @@ import { JwtAuthGuard } from '../auth/guards'
|
||||
import { CreateCardDto, GetAllCardsInDeckDto } from '../cards/dto'
|
||||
import { Card, PaginatedCards } from '../cards/entities/cards.entity'
|
||||
|
||||
import { DecksService } from './decks.service'
|
||||
import { CreateDeckDto, GetAllDecksDto, UpdateDeckDto } from './dto'
|
||||
import { GetRandomCardDto } from './dto/get-random-card.dto'
|
||||
import { Deck, DeckWithAuthor, PaginatedDecks } from './entities/deck.entity'
|
||||
@@ -52,7 +51,7 @@ import {
|
||||
@ApiTags('Decks')
|
||||
@Controller('decks')
|
||||
export class DecksController {
|
||||
constructor(private readonly decksService: DecksService, private commandBus: CommandBus) {}
|
||||
constructor(private commandBus: CommandBus) {}
|
||||
|
||||
@HttpCode(HttpStatus.PARTIAL_CONTENT)
|
||||
@ApiOperation({ description: 'Retrieve paginated decks list.', summary: 'Paginated decks list' })
|
||||
|
||||
@@ -61,7 +61,7 @@ export class DecksRepository {
|
||||
maxCardsCount,
|
||||
orderBy,
|
||||
}: GetAllDecksDto): Promise<PaginatedDecks> {
|
||||
if (!orderBy) {
|
||||
if (!orderBy || orderBy === 'null') {
|
||||
orderBy = 'updated-desc'
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user