This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { createApiResponseSchema } from "./Factory";
|
||||
|
||||
const nullableStringArraySchema = z
|
||||
.array(z.string())
|
||||
.nullish()
|
||||
.transform((value) => value ?? []);
|
||||
|
||||
const nullableArraySchema = z
|
||||
.array(z.any())
|
||||
.nullish()
|
||||
.transform((value) => value ?? []);
|
||||
export interface IAddress {
|
||||
street: string;
|
||||
city: string;
|
||||
@@ -57,16 +67,21 @@ export const companySchema = z.object({
|
||||
phone: z.string().optional(),
|
||||
website: z.string(),
|
||||
type: z.string(),
|
||||
status: z.string().optional(),
|
||||
description: z.string(),
|
||||
founded_year: z.number(),
|
||||
employee_count: z.number(),
|
||||
annual_revenue: z.number(),
|
||||
founded_year: z.number().nullish(),
|
||||
employee_count: z.number().nullish(),
|
||||
annual_revenue: z.number().nullish(),
|
||||
currency: z.string(),
|
||||
industry: z.string(),
|
||||
language: z.string(),
|
||||
tax_id: z.string(),
|
||||
registration_number: z.string(),
|
||||
timezone: z.string(),
|
||||
is_verified: z.boolean().optional(),
|
||||
is_compliant: z.boolean().optional(),
|
||||
created_at: z.number().optional(),
|
||||
updated_at: z.number().optional(),
|
||||
address: z.object({
|
||||
street: z.string(),
|
||||
city: z.string(),
|
||||
@@ -85,13 +100,14 @@ export const companySchema = z.object({
|
||||
position: z.string(),
|
||||
is_primary: z.boolean(),
|
||||
})
|
||||
.nullable()
|
||||
.optional(),
|
||||
tags: z.object({
|
||||
keywords: z.array(z.string()).or(z.null()).optional(),
|
||||
categories: z.array(z.any()).or(z.null()).optional(),
|
||||
specializations: z.array(z.string()).or(z.null()).optional(),
|
||||
certifications: z.array(z.string()).or(z.null()).optional(),
|
||||
cpv_codes: z.array(z.string()).or(z.null()).optional(),
|
||||
keywords: nullableStringArraySchema,
|
||||
categories: nullableArraySchema,
|
||||
specializations: nullableStringArraySchema,
|
||||
certifications: nullableStringArraySchema,
|
||||
cpv_codes: nullableStringArraySchema,
|
||||
}),
|
||||
document_file_ids: z.array(z.string()).or(z.null()).optional(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user