diff --git a/modules/notification/notification_detail.model.js b/modules/notification/notification_detail.model.js index 805db8d..cb577a9 100644 --- a/modules/notification/notification_detail.model.js +++ b/modules/notification/notification_detail.model.js @@ -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" });