From 6cef2c3f5e8f0f127ecc0d9513dd6a5e8007b1d2 Mon Sep 17 00:00:00 2001 From: "mihailo.vojinovic" Date: Wed, 4 Feb 2026 14:27:50 +0100 Subject: Add invoice model --- src/models/invoice.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/models/invoice.ts 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; +export type Invice = z.infer; +export type LineItem = z.infer; -- cgit v1.3.1