feat: NAS storage for invoices/offers, code cleanup, date/time fixes
- NAS storage for created invoices (PDF via puppeteer), received invoices, and offers with auto-save on create/edit - Deterministic file paths derived from DB fields (no file_path column needed) - Separate NAS mount points: NAS_FINANCIALS_PATH, NAS_OFFERS_PATH - Invoice language field (cs/en) stored per invoice, replaces lang modal - Invoices list filtered by month/year matching KPI card selection - Centralized date helpers (src/utils/date.ts) replacing all .toISOString() calls that returned UTC instead of local time - Attendance project switching uses exact time (not rounded) - Comment cleanup: removed ~100 unnecessary/Czech comments - Removed as-any casts in orders and attendance - Prisma migrations: add invoice language, drop received_invoices BLOB columns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,11 @@ dotenv.config();
|
||||
// Set timezone for Date operations — all attendance/time records are in Czech local time
|
||||
process.env.TZ = process.env.TZ || "Europe/Prague";
|
||||
|
||||
// Override Date.toJSON to serialize as local time instead of UTC
|
||||
// MySQL DATETIME stores local time, Prisma creates Date objects,
|
||||
// JSON.stringify calls toJSON() which defaults to toISOString() (UTC with Z suffix).
|
||||
// This causes times to shift by timezone offset on the frontend.
|
||||
// Override Date.toJSON so JSON.stringify outputs local time (Europe/Prague).
|
||||
// Prisma stores UTC in MySQL DATETIME columns. When reading, it creates
|
||||
// JS Date objects with correct UTC internals. The default toJSON() calls
|
||||
// toISOString() which returns UTC — this override uses local getters instead,
|
||||
// so the frontend always receives times in the user's timezone.
|
||||
Date.prototype.toJSON = function () {
|
||||
const y = this.getFullYear();
|
||||
const m = String(this.getMonth() + 1).padStart(2, "0");
|
||||
@@ -53,6 +54,8 @@ export const config = {
|
||||
|
||||
nas: {
|
||||
path: process.env.NAS_PATH || "Z:/02_PROJEKTY",
|
||||
financialsPath: process.env.NAS_FINANCIALS_PATH || "",
|
||||
offersPath: process.env.NAS_OFFERS_PATH || "",
|
||||
maxUploadSize: parseInt(process.env.MAX_UPLOAD_SIZE || "52428800", 10),
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user