fix: remove manual project creation, smart sequence release, received-invoices schema fix

- Remove ProjectCreate page, POST /projects endpoint, and next-number endpoint
- Projects can only be created through orders (shared numbering sequence)
- Remove dead CreateProjectSchema and createProject service function
- Delete 'order' row from number_sequences (unused; code uses 'shared')
- Smart sequence release: decrement last_number only when deleting the highest number
- Fix received-invoices stats referencing non-existent is_deleted and amount_czk columns
- Update deploy instructions in CLAUDE.md (npm install, prisma migrate deploy)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-04-28 11:36:08 +02:00
parent 3481b97d47
commit 82919d39f6
12 changed files with 86 additions and 558 deletions

View File

@@ -1,35 +1,5 @@
import { z } from "zod";
const safeProjectNumber = z
.string()
.regex(/^[\p{L}\p{N}_\-.]+$/u, "Číslo projektu obsahuje nepovolené znaky")
.nullish();
export const CreateProjectSchema = z.object({
project_number: safeProjectNumber,
name: z.string().nullish(),
customer_id: z
.union([z.number(), z.string()])
.transform((v) => Number(v))
.nullish(),
responsible_user_id: z
.union([z.number(), z.string()])
.transform((v) => Number(v))
.nullish(),
quotation_id: z
.union([z.number(), z.string()])
.transform((v) => Number(v))
.nullish(),
order_id: z
.union([z.number(), z.string()])
.transform((v) => Number(v))
.nullish(),
status: z.string().optional().default("aktivni"),
start_date: z.string().nullish(),
end_date: z.string().nullish(),
notes: z.string().nullish(),
});
export const UpdateProjectSchema = z.object({
name: z.string().nullish(),
status: z.string().optional(),
@@ -58,6 +28,5 @@ export const CreateProjectNoteSchema = z.object({
content: z.string().nullish(),
});
export type CreateProjectInput = z.infer<typeof CreateProjectSchema>;
export type UpdateProjectInput = z.infer<typeof UpdateProjectSchema>;
export type CreateProjectNoteInput = z.infer<typeof CreateProjectNoteSchema>;