24 lines
579 B
JavaScript
24 lines
579 B
JavaScript
module.exports = Self => {
|
|
/* Self.validateAsync('warehouseFk', validateWarehouseUniqueness, {
|
|
message: `The warehouse can't be repeated`
|
|
});
|
|
|
|
async function validateWarehouseUniqueness(err, done) {
|
|
let where = {
|
|
itemFk: this.itemFk,
|
|
warehouseFk: this.warehouseFk
|
|
};
|
|
|
|
if (this.id != null)
|
|
where.id = {neq: this.id};
|
|
|
|
let warehouseExists = await Self.findOne({where: where});
|
|
console.log(warehouseExists);
|
|
|
|
if (warehouseExists)
|
|
err();
|
|
|
|
done();
|
|
} */
|
|
};
|