Files
Zumri-Backend/app/models/notification/notification.model.js
Isuru Bimsara 81d0e65686 first commit
2026-08-14 22:46:02 +05:30

56 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/notification.model.js
module.exports = (sequelize, DataTypes) => {
const notification = sequelize.define(
"notification",
{
notification_id: {
type: DataTypes.STRING,
primaryKey: true,
},
notificationHeadline: {
type: DataTypes.STRING,
allowNull: false,
},
notificationDescription: {
type: DataTypes.TEXT,
allowNull: true,
},
notificationType: {
type: DataTypes.ENUM("USER", "ANNOUNCEMENT"),
allowNull: false,
},
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true,
},
dateCreated: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
},
},
{
tableName: "notification",
timestamps: true,
},
);
notification.associate = (models) => {
notification.hasMany(models.userNotification, {
foreignKey: "notification_id",
as: "users",
});
};
return notification;
};