diff options
| author | mihailo.vojinovic <mihailonvojinovic@gmail.com> | 2026-02-04 14:27:50 +0100 |
|---|---|---|
| committer | mihailo.vojinovic <mihailonvojinovic@gmail.com> | 2026-02-04 14:27:50 +0100 |
| commit | 6cef2c3f5e8f0f127ecc0d9513dd6a5e8007b1d2 (patch) | |
| tree | 9fa14b07ae5686b72b893709cc7dbd9541030d83 /src/models | |
| parent | bf023d6846a0ed5cea5f8b27ac8759435ee5ea2f (diff) | |
| download | invoice-6cef2c3f5e8f0f127ecc0d9513dd6a5e8007b1d2.tar.gz invoice-6cef2c3f5e8f0f127ecc0d9513dd6a5e8007b1d2.zip | |
Add invoice model
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/invoice.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/models/invoice.ts b/src/models/invoice.ts new file mode 100644 index 0000000..d6e47c1 --- /dev/null +++ b/src/models/invoice.ts @@ -0,0 +1,28 @@ +import z from "zod"; + +export const Currency = z.enum(["USD", "EUR", "RSD"]); + +export const LineItem = z.object({ + description: z.string(), + quantity: z.number(), + rate: z.number(), +}); + +export const Invoice = z.object({ + invoice_number: z.number(), + from: z.string(), + bill_to: z.string().optional(), + ship_to: z.string().optional(), + date: z.coerce.date().optional(), + payment_terms: z.string().optional(), + due_date: z.coerce.date().optional(), + po_number: z.string().optional(), + currency: Currency, + line_items: z.array(LineItem), + notes: z.string().optional(), + terms: z.string().optional(), +}); + +export type Currency = z.infer<typeof Currency>; +export type Invice = z.infer<typeof Invoice>; +export type LineItem = z.infer<typeof LineItem>; |
