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:
@@ -97,12 +97,10 @@ export async function createUser(data: CreateUserData) {
|
||||
const firstName = data.first_name.trim();
|
||||
const lastName = data.last_name.trim();
|
||||
|
||||
// Email format
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
return { error: "Neplatný formát e-mailu", status: 400 } as const;
|
||||
}
|
||||
|
||||
// Username uniqueness
|
||||
const existingUsername = await prisma.users.findFirst({
|
||||
where: { username },
|
||||
});
|
||||
@@ -110,7 +108,6 @@ export async function createUser(data: CreateUserData) {
|
||||
return { error: "Uživatelské jméno již existuje", status: 409 } as const;
|
||||
}
|
||||
|
||||
// Email uniqueness
|
||||
const existingEmail = await prisma.users.findFirst({ where: { email } });
|
||||
if (existingEmail) {
|
||||
return { error: "E-mail již existuje", status: 409 } as const;
|
||||
@@ -144,7 +141,6 @@ export async function updateUser(id: number, body: UpdateUserData) {
|
||||
|
||||
const data: Record<string, unknown> = {};
|
||||
|
||||
// Username validation and uniqueness
|
||||
if (body.username !== undefined) {
|
||||
const newUsername = String(body.username).trim();
|
||||
if (newUsername !== existing.username) {
|
||||
@@ -161,7 +157,6 @@ export async function updateUser(id: number, body: UpdateUserData) {
|
||||
data.username = newUsername;
|
||||
}
|
||||
|
||||
// Email validation and uniqueness
|
||||
if (body.email !== undefined) {
|
||||
const newEmail = String(body.email).trim();
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(newEmail)) {
|
||||
|
||||
Reference in New Issue
Block a user