Compare commits
No commits in common. "development" and "feat/otp-cancel" have entirely different histories.
developmen
...
feat/otp-c
|
@ -71,7 +71,6 @@ export class ValidateRelationHelper<Entity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
mappingValidator(column, operator, value) {
|
mappingValidator(column, operator, value) {
|
||||||
const candidates = Array.isArray(value) ? value : [value];
|
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case '!=':
|
case '!=':
|
||||||
return column != value;
|
return column != value;
|
||||||
|
@ -80,11 +79,9 @@ export class ValidateRelationHelper<Entity> {
|
||||||
return column == value;
|
return column == value;
|
||||||
|
|
||||||
case 'in':
|
case 'in':
|
||||||
|
const candidates = Array.isArray(value) ? value : [value];
|
||||||
return candidates.includes(column);
|
return candidates.includes(column);
|
||||||
|
|
||||||
case 'not in':
|
|
||||||
return !candidates.includes(column);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return column == value;
|
return column == value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,7 @@ export class ActiveItemManager extends BaseUpdateStatusManager<ItemEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get validateRelations(): validateRelations[] {
|
get validateRelations(): validateRelations[] {
|
||||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
return [
|
||||||
const relation =
|
|
||||||
this.data.bundling_items?.length > 0
|
|
||||||
? 'bundling_items'
|
|
||||||
: 'bundling_parents';
|
|
||||||
|
|
||||||
const validateRelations: validateRelations[] = [
|
|
||||||
{
|
{
|
||||||
relation: 'tenant',
|
relation: 'tenant',
|
||||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||||
|
@ -50,16 +44,6 @@ export class ActiveItemManager extends BaseUpdateStatusManager<ItemEntity> {
|
||||||
message: `Gagal! Terdapat item yang belum aktif`,
|
message: `Gagal! Terdapat item yang belum aktif`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (timeGroupId != null) {
|
|
||||||
validateRelations.push({
|
|
||||||
relation: relation,
|
|
||||||
singleQuery: ['time_group_id', 'not in', [timeGroupId, null]],
|
|
||||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return validateRelations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get entityTarget(): any {
|
get entityTarget(): any {
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
relation: relation,
|
relation: relation,
|
||||||
singleQuery: ['time_group_id', 'not in', [timeGroupId, null]],
|
singleQuery: ['time_group_id', 'in', [timeGroupId, null]],
|
||||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -52,15 +52,12 @@ export class TicketDataService extends BaseDataService<QueueTicket> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!order) {
|
if (!order) {
|
||||||
// Check if id is a valid UUID format
|
|
||||||
const uuidRegex =
|
|
||||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
||||||
const whereCondition = !uuidRegex.test(id)
|
|
||||||
? { invoice_code: id, booking_date: new Date() }
|
|
||||||
: { id, booking_date: new Date() };
|
|
||||||
const { customer_name, customer_phone } =
|
const { customer_name, customer_phone } =
|
||||||
await this.transaction.findOneOrFail({
|
await this.transaction.findOneOrFail({
|
||||||
where: whereCondition,
|
where: {
|
||||||
|
id,
|
||||||
|
booking_date: new Date(),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const start = moment().startOf('day').valueOf();
|
const start = moment().startOf('day').valueOf();
|
||||||
|
|
Loading…
Reference in New Issue