Files
Zumri-Backend/app/models/notification/userNotification.model.js
Sathira Sri Sathara b6b345f245 feat: Implement Phase 2 cross-cutting services with email and notification enhancements
- Refactor email verification and password reset utilities to use new email service.
- Introduce email delivery queue and notification delivery model for better tracking.
- Enhance file validation and storage services for improved security and ownership management.
- Add cron job for cleaning inactive notifications with retention policy.
- Update document worker to handle document generation and storage more efficiently.
- Implement logging improvements in activity and log workers.
- Create comprehensive documentation for new API endpoints and services.
- Add unit tests for file validation and notification policies to ensure robustness.
2026-09-03 14:22:34 +05:30

57 lines
1.2 KiB
JavaScript

/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/models/notification/userNotification.model.js
module.exports = (sequelize, DataTypes) => {
const userNotification = sequelize.define(
"userNotification",
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
user_id: {
type: DataTypes.STRING(255),
allowNull: false,
collate: "utf8mb4_general_ci",
},
notification_id: {
type: DataTypes.STRING,
allowNull: false,
},
isRead: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
},
{
tableName: "user_notification",
timestamps: true,
},
);
userNotification.associate = (models) => {
userNotification.belongsTo(models.User, {
foreignKey: "user_id",
as: "user",
constraints: false,
});
userNotification.belongsTo(models.notification, {
foreignKey: "notification_id",
as: "notification",
constraints: false,
});
};
return userNotification;
};