Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/schemas/organisationSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export const AddressSchema = z.object({
Location: z.preprocess(preprocessJSON, LocationCoordinatesSchema.optional()),
OpeningTimes: z.preprocess(preprocessJSON, z.array(OpeningTimeSchema).default([])),
}).refine((data) => {
// If not open 24/7, must have at least one opening time
if (!data.IsOpen247) {
// If not open 24/7 and not appointment only, must have at least one opening time
if (!data.IsOpen247 && !data.IsAppointmentOnly) {
return data.OpeningTimes.length > 0;
}
return true;
}, {
message: 'At least one opening time is required when location is not open 24/7',
message: 'At least one opening time is required when location is not open 24/7 and not appointment only',
path: ['OpeningTimes']
});

Expand Down