fix: update singleQuery logic in item managers to use 'in' for time_group_id validation
parent
db7bd81eac
commit
99889f425a
|
@ -78,6 +78,10 @@ export class ValidateRelationHelper<Entity> {
|
||||||
case '==':
|
case '==':
|
||||||
return column == value;
|
return column == value;
|
||||||
|
|
||||||
|
case 'in':
|
||||||
|
const candidates = Array.isArray(value) ? value : [value];
|
||||||
|
return candidates.includes(column);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return column == value;
|
return column == value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
relation: relation,
|
relation: relation,
|
||||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
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`,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
relation: relation,
|
relation: relation,
|
||||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
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`,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue