This commit is contained in:
2024-09-10 21:30:03 +02:00
parent 17213ba4b0
commit 83307684ee
25 changed files with 799 additions and 477 deletions

View File

@@ -144,6 +144,10 @@ export const GeoSchema = z.object({
message: 'Longitude muss zwischen -180 und 180 liegen',
},
),
county: z.string().optional().nullable(),
housenumber: z.string().optional().nullable(),
street: z.string().optional().nullable(),
zipCode: z.number().optional().nullable(),
});
const phoneRegex = /^(\+1|1)?[-.\s]?\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/;
export const UserSchema = z
@@ -157,7 +161,7 @@ export const UserSchema = z
companyName: z.string().optional().nullable(),
companyOverview: z.string().optional().nullable(),
companyWebsite: z.string().url({ message: 'Invalid URL format' }).optional().nullable(),
companyLocation: GeoSchema.optional().nullable(),
location: GeoSchema.optional().nullable(),
offeredServices: z.string().optional().nullable(),
areasServed: z.array(AreasServedSchema).optional().nullable(),
hasProfile: z.boolean().optional().nullable(),
@@ -213,7 +217,7 @@ export const UserSchema = z
});
}
if (!data.companyLocation) {
if (!data.location) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Company location is required for professional customers',