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);