This commit is contained in:
David Arranz 2019-10-21 11:38:47 +02:00
parent d241db12e8
commit 95413ca00e

View File

@ -57,6 +57,15 @@ module.exports = function (sequelize, DataTypes) {
timestamps: true,
});
NotificationDetail.addScope('onlyWithoutReceipt', () => {
return {
where: {
receiptDate: { [Sequelize.Op.ne]: null }
}
}
});
NotificationDetail.associate = function (models) {
NotificationDetail.User = NotificationDetail.belongsTo(models.User, { foreignKey: 'userId', as: "user" });
//NotificationDetail.Notification = NotificationDetail.belongsTo(models.Notification, { foreignKey: 'notificationId', as: "user" });