- 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:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
+6
-1
@@ -1,7 +1,12 @@
|
|||||||
import type { Handle } from '@sveltejs/kit';
|
import { redirect, type Handle } from '@sveltejs/kit';
|
||||||
import { validateSession, setSessionCookie } from '$lib/server/auth/index.js';
|
import { validateSession, setSessionCookie } from '$lib/server/auth/index.js';
|
||||||
|
|
||||||
export const handle: Handle = async ({ event, resolve }) => {
|
export const handle: Handle = async ({ event, resolve }) => {
|
||||||
|
// Redirect implicit /favicon.ico requests to our SVG to avoid 404 noise
|
||||||
|
if (event.url.pathname === '/favicon.ico') {
|
||||||
|
redirect(302, '/favicon.svg');
|
||||||
|
}
|
||||||
|
|
||||||
const token = event.cookies.get('session');
|
const token = event.cookies.get('session');
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
} from '../db/schema.js';
|
} from '../db/schema.js';
|
||||||
import { csvBuild } from '$lib/utils/csv.js';
|
import { csvBuild } from '$lib/utils/csv.js';
|
||||||
import { CARRIER_LABELS } from '../shipping/index.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';
|
import { alias } from 'drizzle-orm/pg-core';
|
||||||
|
|
||||||
const PROVIDER_LABELS: Record<string, string> = {
|
const PROVIDER_LABELS: Record<string, string> = {
|
||||||
@@ -362,9 +362,7 @@ export async function buildFinancialExport(
|
|||||||
})
|
})
|
||||||
.from(invoiceLineItems)
|
.from(invoiceLineItems)
|
||||||
.innerJoin(invoices, eq(invoiceLineItems.invoiceId, invoices.id))
|
.innerJoin(invoices, eq(invoiceLineItems.invoiceId, invoices.id))
|
||||||
.where(
|
.where(inArray(invoiceLineItems.invoiceId, invoiceIds));
|
||||||
sql`${invoiceLineItems.invoiceId} = ANY(${invoiceIds})`
|
|
||||||
);
|
|
||||||
|
|
||||||
const rows: unknown[][] = [
|
const rows: unknown[][] = [
|
||||||
['id', 'invoiceId', 'invoiceNumber', 'description', 'quantity', 'unitPrice', 'total']
|
['id', 'invoiceId', 'invoiceNumber', 'description', 'quantity', 'unitPrice', 'total']
|
||||||
@@ -496,7 +494,7 @@ export async function buildFinancialExport(
|
|||||||
.from(payslipLineItems)
|
.from(payslipLineItems)
|
||||||
.innerJoin(payslips, eq(payslipLineItems.payslipId, payslips.id))
|
.innerJoin(payslips, eq(payslipLineItems.payslipId, payslips.id))
|
||||||
.innerJoin(employees, eq(payslips.employeeId, employees.id))
|
.innerJoin(employees, eq(payslips.employeeId, employees.id))
|
||||||
.where(sql`${payslipLineItems.payslipId} = ANY(${payslipIds})`);
|
.where(inArray(payslipLineItems.payslipId, payslipIds));
|
||||||
|
|
||||||
const rows: unknown[][] = [
|
const rows: unknown[][] = [
|
||||||
['id', 'payslipId', 'payslipPeriod', 'employeeName', 'type', 'label', 'amount', 'isStatutory']
|
['id', 'payslipId', 'payslipPeriod', 'employeeName', 'type', 'label', 'amount', 'isStatutory']
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||||
|
<rect width="32" height="32" rx="6" fill="#2563eb"/>
|
||||||
|
<text x="16" y="22" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="700" text-anchor="middle" fill="#ffffff">฿</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 276 B |
Reference in New Issue
Block a user