mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ready to test
Testing Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/***********************************************************************************************************************************************************************
|
||||
* File Name : notification.mdl.js
|
||||
* Type : Sequelize Model
|
||||
* Description : Admin-facing system notifications. Each row is a single event
|
||||
* surfaced in the admin bell dropdown (e.g. "5 tasks overdue").
|
||||
* Not user-scoped — visible to all admins.
|
||||
*
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jun. 19, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../../config/db.config');
|
||||
|
||||
const AdminNotification = sequelize.define('AdminNotification', {
|
||||
notification_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
},
|
||||
type: {
|
||||
type: DataTypes.STRING(64),
|
||||
allowNull: false,
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
},
|
||||
message: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: false,
|
||||
},
|
||||
data: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
seen: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
},
|
||||
seen_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
}, {
|
||||
tableName: 'admin_notifications',
|
||||
timestamps: true,
|
||||
indexes: [
|
||||
{ fields: ['seen'], name: 'idx_an_seen' },
|
||||
{ fields: ['type'], name: 'idx_an_type' },
|
||||
{ fields: ['createdAt'], name: 'idx_an_created_at' },
|
||||
],
|
||||
});
|
||||
|
||||
module.exports = AdminNotification;
|
||||
@@ -0,0 +1,62 @@
|
||||
/***********************************************************************************************************************************************************************
|
||||
* File Name : user_notification.mdl.js
|
||||
* Type : Sequelize Model
|
||||
* Description : Client-facing per-user notifications (achievement unlocked,
|
||||
* task events, etc.). Scoped to a single user_id — each row
|
||||
* is private to the user it belongs to.
|
||||
*
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jun. 19, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../../config/db.config');
|
||||
|
||||
const UserNotification = sequelize.define('UserNotification', {
|
||||
notification_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
},
|
||||
user_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
},
|
||||
type: {
|
||||
type: DataTypes.STRING(64),
|
||||
allowNull: false,
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
},
|
||||
message: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: false,
|
||||
},
|
||||
data: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
seen: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
},
|
||||
seen_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
}, {
|
||||
tableName: 'user_notifications',
|
||||
timestamps: true,
|
||||
indexes: [
|
||||
{ fields: ['user_id'], name: 'idx_un_user_id' },
|
||||
{ fields: ['user_id', 'seen'], name: 'idx_un_seen' },
|
||||
{ fields: ['type'], name: 'idx_un_type' },
|
||||
{ fields: ['createdAt'], name: 'idx_un_created_at' },
|
||||
],
|
||||
});
|
||||
|
||||
module.exports = UserNotification;
|
||||
Reference in New Issue
Block a user