- Replace raw `ANY(${array})` SQL with drizzle's inArray() in
src/lib/server/export/financial.ts; the raw form sent UUID arrays
in a malformed Postgres array literal causing 500 on download
- Add static/favicon.svg (Thai baht symbol on blue square) and point
app.html at it; remove the empty favicon.png
- Redirect /favicon.ico to /favicon.svg in hooks.server.ts so
browsers' implicit fallback request stops 404'ing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
} from '../db/schema.js';
|
||||
import { csvBuild } from '$lib/utils/csv.js';
|
||||
import { CARRIER_LABELS } from '../shipping/index.js';
|
||||
import { eq, and, sql, asc } from 'drizzle-orm';
|
||||
import { eq, and, sql, asc, inArray } from 'drizzle-orm';
|
||||
import { alias } from 'drizzle-orm/pg-core';
|
||||
|
||||
const PROVIDER_LABELS: Record<string, string> = {
|
||||
@@ -362,9 +362,7 @@ export async function buildFinancialExport(
|
||||
})
|
||||
.from(invoiceLineItems)
|
||||
.innerJoin(invoices, eq(invoiceLineItems.invoiceId, invoices.id))
|
||||
.where(
|
||||
sql`${invoiceLineItems.invoiceId} = ANY(${invoiceIds})`
|
||||
);
|
||||
.where(inArray(invoiceLineItems.invoiceId, invoiceIds));
|
||||
|
||||
const rows: unknown[][] = [
|
||||
['id', 'invoiceId', 'invoiceNumber', 'description', 'quantity', 'unitPrice', 'total']
|
||||
@@ -496,7 +494,7 @@ export async function buildFinancialExport(
|
||||
.from(payslipLineItems)
|
||||
.innerJoin(payslips, eq(payslipLineItems.payslipId, payslips.id))
|
||||
.innerJoin(employees, eq(payslips.employeeId, employees.id))
|
||||
.where(sql`${payslipLineItems.payslipId} = ANY(${payslipIds})`);
|
||||
.where(inArray(payslipLineItems.payslipId, payslipIds));
|
||||
|
||||
const rows: unknown[][] = [
|
||||
['id', 'payslipId', 'payslipPeriod', 'employeeName', 'type', 'label', 'amount', 'isStatutory']
|
||||
|
||||
Reference in New Issue
Block a user