Compare commits
6 Commits
5dde995ab8
...
ffcbf65d9d
Author | SHA1 | Date |
---|---|---|
|
ffcbf65d9d | |
|
2f19db8dd7 | |
|
e7664be8a8 | |
|
a2c1af2a65 | |
|
26db7d2745 | |
|
e922db827d |
|
@ -116,4 +116,19 @@ export class ItemModel
|
|||
onUpdate: 'CASCADE',
|
||||
})
|
||||
gates: GateModel[];
|
||||
|
||||
// relasi untuk mendapatkan parent bundling
|
||||
@ManyToMany(() => ItemModel, (model) => model.bundling_parents)
|
||||
@JoinTable({
|
||||
name: 'item_bundlings',
|
||||
joinColumn: {
|
||||
name: 'item_id',
|
||||
referencedColumnName: 'id',
|
||||
},
|
||||
inverseJoinColumn: {
|
||||
name: 'item_bundling_id',
|
||||
referencedColumnName: 'id',
|
||||
},
|
||||
})
|
||||
bundling_parents: ItemModel[];
|
||||
}
|
||||
|
|
|
@ -26,7 +26,12 @@ export class BatchDeleteItemManager extends BaseBatchDeleteManager<ItemEntity> {
|
|||
}
|
||||
|
||||
get validateRelations(): validateRelations[] {
|
||||
return [];
|
||||
return [
|
||||
{
|
||||
relation: 'bundling_parents',
|
||||
message: `Gagal! Item sudah berelasi dengen bundling`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get entityTarget(): any {
|
||||
|
|
|
@ -29,7 +29,12 @@ export class DeleteItemManager extends BaseDeleteManager<ItemEntity> {
|
|||
}
|
||||
|
||||
get validateRelations(): validateRelations[] {
|
||||
return [];
|
||||
return [
|
||||
{
|
||||
relation: 'bundling_parents',
|
||||
message: `Gagal! Item sudah berelasi dengen bundling`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get entityTarget(): any {
|
||||
|
|
Loading…
Reference in New Issue