a752a399c2
Build & Deploy / Build & Push Docker Image (push) Successful in 12m39s
Test / Type Check (all packages) (push) Successful in 5m8s
Build & Deploy / Deploy to VPS (push) Successful in 7s
Test / API Unit Tests (push) Failing after 4m24s
Test / Homepage Unit Tests (push) Successful in 3m27s
Test / Storefront Unit Tests (push) Successful in 4m48s
Test / Admin Unit Tests (push) Successful in 3m0s
Test / Dashboard Unit Tests (push) Successful in 4m18s
Test / API Integration Tests (push) Failing after 4m34s
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
const queryBooleanSchema = z.preprocess((value) => {
|
|
if (value === 'true') return true
|
|
if (value === 'false') return false
|
|
return value
|
|
}, z.boolean())
|
|
|
|
export const billingListQuerySchema = z.object({
|
|
page: z.coerce.number().int().positive().default(1),
|
|
pageSize: z.coerce.number().int().positive().max(100).default(25),
|
|
search: z.string().trim().max(120).optional().default(''),
|
|
paymentStatus: z.enum(['ALL', 'UNPAID', 'PARTIAL', 'PAID']).optional().default('ALL'),
|
|
outstandingOnly: queryBooleanSchema.optional().default(false),
|
|
})
|
|
|
|
export const billingSummaryQuerySchema = z.object({
|
|
search: z.string().trim().max(120).optional().default(''),
|
|
})
|
|
|
|
export const invoiceParamSchema = z.object({
|
|
invoiceId: z.string().min(1),
|
|
})
|
|
|
|
export const manualBillingPaymentSchema = z.object({
|
|
amountMinor: z.number().int().positive(),
|
|
currency: z.literal('MAD').default('MAD'),
|
|
type: z.enum(['CHARGE', 'DEPOSIT']),
|
|
method: z.enum(['CASH', 'CHECK', 'BANK_TRANSFER', 'CARD', 'PAYPAL', 'OTHER']),
|
|
receivedAt: z.string().datetime().optional(),
|
|
reference: z.string().trim().max(120).optional(),
|
|
note: z.string().trim().max(1000).optional(),
|
|
idempotencyKey: z.string().uuid(),
|
|
})
|