| 1 | import z from 'zod' |
| 2 | |
| 3 | export const createExpenseSchema = |
| 4 | projectId: z.string |
| 5 | title: z.string |
| 6 | amountCents: z.number |
| 7 | currency: z.string |
| 8 | date: z.string |
| 9 | categoryId: z.string |
| 10 | milestoneId: z.string |
| 11 | billable: z.boolean |
| 12 | recurring: z.boolean |
| 13 | description: z.string |
| 14 | receiptMediaId: z.string |
| 15 | }) |
| 16 | |
| 17 | export const updateExpenseSchema = |
| 18 | expenseId: z.string |
| 19 | title: z.string |
| 20 | amountCents: z.number |
| 21 | currency: z.string |
| 22 | date: z.string |
| 23 | categoryId: z.string |
| 24 | milestoneId: z.string |
| 25 | billable: z.boolean |
| 26 | recurring: z.boolean |
| 27 | description: z.string |
| 28 | receiptMediaId: z.string |
| 29 | }) |
| 30 | |
| 31 | export const deleteExpenseSchema = |
| 32 | expenseId: z.string |
| 33 | }) |
| 34 | |
| 35 | export const submitExpensesSchema = |
| 36 | expenseIds: z.array |
| 37 | }) |
| 38 | |
| 39 | export const approveExpensesSchema = |
| 40 | expenseIds: z.array |
| 41 | }) |
| 42 | |
| 43 | export const rejectExpensesSchema = |
| 44 | expenseIds: z.array |
| 45 | reason: z.string |
| 46 | }) |
| 47 | |
| 48 | export const sendExpensesToClientSchema = |
| 49 | expenseIds: z.array |
| 50 | clientMemberIds: z.array |
| 51 | }) |
| 52 | |
| 53 | export const clientRespondExpensesSchema = |
| 54 | expenseIds: z.array |
| 55 | action: z.enum |
| 56 | reason: z.string |
| 57 | }) |
| 58 | |
| 59 | export const createExpenseCategorySchema = |
| 60 | organizationId: z.string |
| 61 | name: z.string |
| 62 | color: z.string |
| 63 | }) |
| 64 | |
| 65 | export const updateExpenseCategorySchema = |
| 66 | categoryId: z.string |
| 67 | name: z.string |
| 68 | color: z.string |
| 69 | }) |
| 70 | |
| 71 | export const archiveExpenseCategorySchema = |
| 72 | categoryId: z.string |
| 73 | }) |
| 74 | |
| 75 | export function formatCurrency(amountCents |
| 76 | return new Intl |
| 77 | style: 'currency', |
| 78 | currency, |
| 79 | }).format(amountCents |
| 80 | } |