From 25057bf8fbe2180da747070b21debe5c05138f1c Mon Sep 17 00:00:00 2001 From: casperiv0 <53900565+casperiv0@users.noreply.github.com> Date: Sun, 8 Oct 2023 08:39:17 +0200 Subject: [PATCH] fix: small fixes --- .../admin/manage/citizens/records-logs-controller.ts | 5 +++-- .../pages/officer/supervisor/citizen-logs/[citizenId].tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/api/src/controllers/admin/manage/citizens/records-logs-controller.ts b/apps/api/src/controllers/admin/manage/citizens/records-logs-controller.ts index 0129b7c33..eb5f25b1f 100644 --- a/apps/api/src/controllers/admin/manage/citizens/records-logs-controller.ts +++ b/apps/api/src/controllers/admin/manage/citizens/records-logs-controller.ts @@ -123,13 +123,14 @@ export class AdminManageCitizensController { where: { OR: [{ citizenId }, { citizen: { socialSecurityNumber: citizenId } }] }, }), prisma.recordLog.findMany({ + orderBy: { createdAt: "desc" }, + where: { OR: [{ citizenId }, { citizen: { socialSecurityNumber: citizenId } }] }, take: includeAll ? undefined : 35, skip: includeAll ? undefined : skip, - where: { OR: [{ citizenId }, { citizen: { socialSecurityNumber: citizenId } }] }, - orderBy: { createdAt: "desc" }, include: { warrant: { include: { officer: { include: leoProperties } } }, records: { include: recordsLogsInclude }, + business: { include: { employees: { where: { role: { as: "OWNER" } } } } }, citizen: { include: { user: { select: userProperties }, gender: true, ethnicity: true }, }, diff --git a/apps/client/src/pages/officer/supervisor/citizen-logs/[citizenId].tsx b/apps/client/src/pages/officer/supervisor/citizen-logs/[citizenId].tsx index e7f28ef70..bbfcbe3a7 100644 --- a/apps/client/src/pages/officer/supervisor/citizen-logs/[citizenId].tsx +++ b/apps/client/src/pages/officer/supervisor/citizen-logs/[citizenId].tsx @@ -70,8 +70,8 @@ export default function CitizenLogs(props: Props) { tableState={tableState} data={asyncTable.items.map((item) => { const type = item.records !== null ? TYPE_LABELS[item.records.type] : t("warrant"); - const createdAt = item.warrant?.createdAt ?? item.records?.createdAt; - const officer = item.warrant?.officer ?? item.records?.officer; + const createdAt = item.records?.createdAt ?? item.warrant?.createdAt; + const officer = item.records?.officer ?? item.warrant?.officer; const officerName = officer && makeUnitName(officer); const callsign = officer && generateCallsign(officer);