Files
accounted/lib/pending-operations/schemas/customer.ts
T
Mattsson e11f70b347 Bug/gh issues fiz (#1103)
* refactor: optimize page loading and data fetching

* fix: resolve recurring production runtime errors

* feat: add MCP company and customer updates

* fix: handle year-end tax adjustments

* feat: harden annual report compliance

* fix: expand invoice logo and font support

* fix: sanitize API route error responses

* fix: sanitize user-facing error messages

* feat: persist onboarding and tax assessment notices

* fix: reduce cloud backup audit churn

* feat: refine invoice editor layout

* fix: show saved tax adjustments in INK2

* fix: complete annual report API mappings

* docs: record operational safeguards and decisions

* fix: harden annual report review findings

* fix: adjust column span for description based on VAT registration

* New css class name
2026-07-21 23:00:15 +02:00

40 lines
1.4 KiB
TypeScript

import { z } from 'zod'
import { UpdateCustomerSchema } from '@/lib/api/schemas'
const CustomerChangesSchema = z
.object({
name: UpdateCustomerSchema.shape.name,
customer_type: UpdateCustomerSchema.shape.customer_type,
customer_number: UpdateCustomerSchema.shape.customer_number,
email: UpdateCustomerSchema.shape.email,
phone: UpdateCustomerSchema.shape.phone,
address_line1: UpdateCustomerSchema.shape.address_line1,
address_line2: UpdateCustomerSchema.shape.address_line2,
postal_code: UpdateCustomerSchema.shape.postal_code,
city: UpdateCustomerSchema.shape.city,
country: UpdateCustomerSchema.shape.country,
org_number: UpdateCustomerSchema.shape.org_number,
vat_number: UpdateCustomerSchema.shape.vat_number,
language: UpdateCustomerSchema.shape.language,
default_payment_terms: UpdateCustomerSchema.shape.default_payment_terms,
notes: UpdateCustomerSchema.shape.notes,
})
.strict()
.superRefine((changes, ctx) => {
if (Object.keys(changes).length === 0) {
ctx.addIssue({
code: 'custom',
message: 'At least one customer field must be supplied',
})
}
})
export const UpdateCustomerParamsSchema = z
.object({
customer_id: z.string().uuid(),
changes: CustomerChangesSchema,
})
.strict()
export type UpdateCustomerParams = z.infer<typeof UpdateCustomerParamsSchema>