From ef54dc14e7eff0ae534003dc0763e83aeb3930a4 Mon Sep 17 00:00:00 2001 From: Andres Date: Wed, 12 Jun 2024 10:20:24 +0200 Subject: [PATCH] fix: unfuck orderBy --- src/modules/cards/infrastructure/cards.repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/cards/infrastructure/cards.repository.ts b/src/modules/cards/infrastructure/cards.repository.ts index 510681a..08f5153 100644 --- a/src/modules/cards/infrastructure/cards.repository.ts +++ b/src/modules/cards/infrastructure/cards.repository.ts @@ -100,7 +100,7 @@ export class CardsRepository { SELECT c.*, g.grade as "userGrade", COALESCE(a."attemptCount", 0) as "totalAttempts" FROM flashcards.card AS c LEFT JOIN flashcards.grade AS g ON c.id = g."cardId" AND g."userId" = $1 - LEFT JOIN flashcards.cardAttempt AS a ON c.id = a."cardId" AND a."userId" = $1 + LEFT JOIN flashcards."cardAttempt" AS a ON c.id = a."cardId" AND a."userId" = $1 WHERE c."deckId" = $2 AND (${whereClause}) ORDER BY g."grade" ${direction === 'asc' ? 'ASC NULLS FIRST' : 'DESC NULLS LAST'} LIMIT $${queryParams.length + 1} OFFSET $${queryParams.length + 2}