From 70a3c43c479e773abcaf56bec428e972f8a8f0f9 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 7 Aug 2023 17:14:24 +0200 Subject: [PATCH] fix orderby --- src/modules/cards/infrastructure/cards.repository.ts | 5 ++++- src/modules/decks/infrastructure/decks.repository.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/cards/infrastructure/cards.repository.ts b/src/modules/cards/infrastructure/cards.repository.ts index 6f78c14..5bf54c2 100644 --- a/src/modules/cards/infrastructure/cards.repository.ts +++ b/src/modules/cards/infrastructure/cards.repository.ts @@ -62,9 +62,12 @@ export class CardsRepository { question = undefined, currentPage, itemsPerPage, - orderBy = 'updated-desc', + orderBy, }: GetAllCardsInDeckDto ): Promise { + if (!orderBy) { + orderBy = 'updated-desc' + } try { const where = { decks: { diff --git a/src/modules/decks/infrastructure/decks.repository.ts b/src/modules/decks/infrastructure/decks.repository.ts index f97c8af..41e99ac 100644 --- a/src/modules/decks/infrastructure/decks.repository.ts +++ b/src/modules/decks/infrastructure/decks.repository.ts @@ -59,8 +59,11 @@ export class DecksRepository { itemsPerPage, minCardsCount, maxCardsCount, - orderBy = 'updated-desc', + orderBy, }: GetAllDecksDto): Promise { + if (!orderBy) { + orderBy = 'updated-desc' + } try { const where = { cardsCount: {