mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 15:25:45 +00:00
fix(empty-return-requests): map queue columns to camelCase
`findAll` selected `r.*` in raw SQL. `dataSource.query` bypasses the entity
mapping, so rows came back under their database names — `container_numbers`,
`submitted_at`, `quoted_total_amount` — while both clients read camelCase.
Every field on the row was undefined; the backoffice queue crashed on
`containerNumbers.join(", ")` and took the page down through the error
boundary.
Alias each column explicitly, the way `plannedReturns()` below it already
does, and cast the two numeric columns with `::float8` — raw SQL skips the
entity's numeric->Number transformer, which would otherwise hand the clients
strings. Type the result as `EmptyReturnRequestRow` so the signature matches
what the projection actually selects rather than claiming absent fields.
Guard the three `containerNumbers.join(...)` call sites too, so one odd row
cannot white-screen the queue again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,7 @@ export default function EmptyReturnRequestsPage() {
|
||||
const controls = useListControls(requests, {
|
||||
dateKey: "submittedAt",
|
||||
searchValue: (row) =>
|
||||
`${row.bookingReference ?? ""} ${row.companyName ?? ""} ${row.containerNumbers.join(" ")}`,
|
||||
`${row.bookingReference ?? ""} ${row.companyName ?? ""} ${(row.containerNumbers ?? []).join(" ")}`,
|
||||
});
|
||||
|
||||
const invalidate = () => {
|
||||
@@ -143,7 +143,7 @@ export default function EmptyReturnRequestsPage() {
|
||||
<Stack gap={2}>
|
||||
<Badge size="sm">{row.original.containerCount}</Badge>
|
||||
<Text size="xs" c="dimmed" lineClamp={2}>
|
||||
{row.original.containerNumbers.join(", ")}
|
||||
{(row.original.containerNumbers ?? []).join(", ")}
|
||||
</Text>
|
||||
</Stack>
|
||||
),
|
||||
@@ -386,7 +386,7 @@ function ApproveModal({
|
||||
Containers coming back
|
||||
</Text>
|
||||
<Text size="sm" c="dimmed">
|
||||
{request.containerNumbers.join(", ")}
|
||||
{(request.containerNumbers ?? []).join(", ")}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user