BugFix: #90,#86 + Restrictions on seller

This commit is contained in:
2024-08-26 17:38:38 +02:00
parent f66badbfb1
commit 8157dcc376
11 changed files with 62 additions and 370 deletions

View File

@@ -52,7 +52,7 @@ export class CommercialPropertyService {
if (!user?.roles?.includes('ADMIN') ?? false) {
whereConditions.push(or(eq(commercials.email, user?.username), ne(commercials.draft, true)));
}
whereConditions.push(and(eq(schema.users.customerType, 'professional')));
// whereConditions.push(and(eq(schema.users.customerType, 'professional')));
return whereConditions;
}
// #### Find by criteria ########################################

View File

@@ -104,12 +104,22 @@ const USStates = z.enum([
]);
export const AreasServedSchema = z.object({
county: z.string().optional().nullable(),
state: z.string().nonempty('State is required'),
state: z
.string()
.nullable()
.refine(val => val !== null && val !== '', {
message: 'State is required',
}),
});
export const LicensedInSchema = z.object({
registerNo: z.string().nonempty('Registration number is required'),
state: z.string().nonempty('State is required'),
state: z
.string()
.nullable()
.refine(val => val !== null && val !== '', {
message: 'State is required',
}),
registerNo: z.string().nonempty('License number is required'),
});
export const GeoSchema = z.object({
name: z.string(),