sml chng
This commit is contained in:
@@ -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