fix orderBy not allowing null

This commit is contained in:
andres
2023-08-12 13:42:44 +02:00
parent e615fe7711
commit 2626bf3815
4 changed files with 4 additions and 6 deletions

View File

@@ -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' })

View File

@@ -61,7 +61,7 @@ export class DecksRepository {
maxCardsCount,
orderBy,
}: GetAllDecksDto): Promise<PaginatedDecks> {
if (!orderBy) {
if (!orderBy || orderBy === 'null') {
orderBy = 'updated-desc'
}
try {