sml chng
This commit is contained in:
@@ -21,7 +21,7 @@ export const PriceDto = z.object({
|
||||
/* ================= VENUE ================= */
|
||||
export const VenueDto = z.object({
|
||||
venueName: z.string(),
|
||||
venueLabel:z.string(),
|
||||
venueLabel: z.string(),
|
||||
venueCapacity: z.number().int().optional().default(0),
|
||||
availableSeats: z.number().int().optional().default(0),
|
||||
isMinPeopleReqMandatory: z.boolean().optional().default(false),
|
||||
@@ -45,7 +45,6 @@ export const PickupDetailDto = z.object({
|
||||
transportTotalPrice: z.number().int().min(1),
|
||||
});
|
||||
|
||||
|
||||
export const PickupTransportDto = z.object({
|
||||
transportModeXid: z.number().int(),
|
||||
pickupDetails: z.array(PickupDetailDto).optional().default([]),
|
||||
@@ -136,7 +135,7 @@ export const CreateActivityDto = z.object({
|
||||
equipmentIsChargeable: z.boolean().optional().default(false),
|
||||
|
||||
cancellationAvailable: z.boolean().optional().default(false),
|
||||
cancellationAllowedBeforeMins:z.number().optional().default(null),
|
||||
cancellationAllowedBeforeMins: z.number().int().nullable().optional(),
|
||||
|
||||
/* MONEY / CURRENCY */
|
||||
currencyXid: z.number().int().nullable().optional(),
|
||||
|
||||
@@ -1812,15 +1812,15 @@ export class HostService {
|
||||
select: {
|
||||
countryName: true,
|
||||
countryCode: true,
|
||||
countryFlag: true
|
||||
}
|
||||
countryFlag: true,
|
||||
},
|
||||
},
|
||||
taxName: true,
|
||||
taxPer: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1869,12 +1869,12 @@ export class HostService {
|
||||
},
|
||||
ActivityFoodCost: {
|
||||
where: {
|
||||
isActive: true
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
totalAmount: true
|
||||
}
|
||||
totalAmount: true,
|
||||
},
|
||||
},
|
||||
activityCuisines: {
|
||||
where: {
|
||||
@@ -2410,36 +2410,36 @@ export class HostService {
|
||||
|
||||
payload.trainerTotalAmount = toNumber(payload.trainerTotalAmount);
|
||||
payload.cancellationAllowedBeforeMins = toNumber(
|
||||
payload.cancellationAllowedBeforeMins,
|
||||
);
|
||||
payload.cancellationAllowedBeforeMins,
|
||||
);
|
||||
|
||||
/* =====================================================
|
||||
* CANCELLATION VALIDATION (NO CONVERSION)
|
||||
* ===================================================== */
|
||||
if (payload.cancellationAvailable) {
|
||||
if (
|
||||
typeof payload.cancellationAllowedBeforeMins !== 'number' ||
|
||||
Number.isNaN(payload.cancellationAllowedBeforeMins) ||
|
||||
payload.cancellationAllowedBeforeMins <= 0
|
||||
) {
|
||||
throw new ApiError(
|
||||
400,
|
||||
'cancellationAllowedBeforeMins must be a positive number (in minutes)',
|
||||
);
|
||||
}
|
||||
/* =====================================================
|
||||
* CANCELLATION VALIDATION (NO CONVERSION)
|
||||
* ===================================================== */
|
||||
if (payload.cancellationAvailable) {
|
||||
if (
|
||||
typeof payload.cancellationAllowedBeforeMins !== 'number' ||
|
||||
Number.isNaN(payload.cancellationAllowedBeforeMins) ||
|
||||
payload.cancellationAllowedBeforeMins <= 0
|
||||
) {
|
||||
throw new ApiError(
|
||||
400,
|
||||
'cancellationAllowedBeforeMins must be a positive number (in minutes)',
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
activityDurationMins > 0 &&
|
||||
payload.cancellationAllowedBeforeMins >= activityDurationMins
|
||||
) {
|
||||
throw new ApiError(
|
||||
400,
|
||||
'cancellationAllowedBeforeMins must be less than activity duration',
|
||||
);
|
||||
if (
|
||||
activityDurationMins > 0 &&
|
||||
payload.cancellationAllowedBeforeMins >= activityDurationMins
|
||||
) {
|
||||
throw new ApiError(
|
||||
400,
|
||||
'cancellationAllowedBeforeMins must be less than activity duration',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
delete payload.cancellationAllowedBeforeMins;
|
||||
}
|
||||
} else {
|
||||
delete payload.cancellationAllowedBeforeMins;
|
||||
}
|
||||
|
||||
if (payload.trainerAvailable) {
|
||||
if (
|
||||
@@ -2628,6 +2628,9 @@ export class HostService {
|
||||
equipmentAvailable: payload.equipmentAvailable,
|
||||
equipmentIsChargeable: toBool(payload.equipmentIsChargeable),
|
||||
cancellationAvailable: payload.cancellationAvailable,
|
||||
cancellationAllowedBeforeMins: payload.cancellationAvailable
|
||||
? payload.cancellationAllowedBeforeMins
|
||||
: null,
|
||||
|
||||
activityInternalStatus,
|
||||
activityDisplayStatus,
|
||||
|
||||
Reference in New Issue
Block a user