2018-05-04 09:46:03 +00:00
|
|
|
module.exports = Self => {
|
2018-08-30 06:50:03 +00:00
|
|
|
/* 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();
|
|
|
|
} */
|
2018-02-20 11:25:51 +00:00
|
|
|
};
|