Files
bowlingManager/backend/models/Notification.js
T
2025-04-17 23:32:39 +09:00

60 lines
1.1 KiB
JavaScript

const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
const Notification = sequelize.define('Notification', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
title: {
type: DataTypes.STRING,
allowNull: false
},
message: {
type: DataTypes.TEXT,
allowNull: false
},
icon: {
type: DataTypes.STRING,
defaultValue: 'pi pi-info-circle'
},
type: {
type: DataTypes.ENUM('info', 'success', 'warning', 'error'),
defaultValue: 'info'
},
read: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
},
link: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
}
}, {
timestamps: true,
tableName: 'Notifications'
});
module.exports = Notification;