From d066f0b2795708b5aea7aeb6e59c859b74b36940 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:27:28 +0200 Subject: [PATCH] Add id as secondary sort criterion to ensure consistent ordering --- apps/api/src/app/order/order.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index a1fa4db6c..0255a5011 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -291,7 +291,8 @@ export class OrderService { withExcludedAccounts?: boolean; }): Promise { let orderBy: Prisma.Enumerable = [ - { date: 'asc' } + { date: 'asc' }, + { id: 'asc' } ]; const where: Prisma.OrderWhereInput = { userId }; @@ -367,7 +368,7 @@ export class OrderService { } if (sortColumn) { - orderBy = [{ [sortColumn]: sortDirection }]; + orderBy = [{ [sortColumn]: sortDirection }, { id: sortDirection }]; } if (types) {