Untitled
Anonymous
javascript
07/22/2023 6:13 AM
2.3 KB
17
Indexable
import { DataTypes } from "sequelize";
import {
NOTIFICATION_ACTION,
NOTIFICATION_TYPE,
} from "../interfaces/notification/notification.enum";
import { sequelize } from "../start/sequelize";
const Notification = sequelize.define("Notification", {
_id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
},
userIdFrom: {
type: DataTypes.UUID,
defaultValue: null,
allowNull: true,
references: {
model: sequelize.models.User,
key: "_id",
},
},
userIdTo: {
type: DataTypes.UUID,
defaultValue: null,
allowNull: true,
references: {
model: sequelize.models.User,
key: "_id",
},
},
content: {
type: DataTypes.STRING,
allowNull: false,
},
type: {
type: DataTypes.ENUM(
"user",
"rating",
"proposal",
"post",
"hire",
"payment",
"contract"
),
defaultValue: NOTIFICATION_TYPE.USER,
allowNull: true,
},
action: {
type: DataTypes.ENUM(
"Nộp hồ sơ",
"Chấp nhận hồ sơ",
"Yêu cầu tạo hợp đồng",
"Xác nhận hợp đồng",
"Hủy hợp đồng",
"Xác nhận hoàn thành công việc",
"Công khai thông tin",
"Thuê",
"Thêm vào ví",
"Dùng",
"Đánh giá",
"Chào mừng"
),
defaultValue: NOTIFICATION_ACTION.GREETING,
allowNull: true,
},
isRead: {
type: DataTypes.BOOLEAN,
defaultValue: false,
allowNull: false,
},
typeNoId: {
type: DataTypes.UUID,
defaultValue: null,
allowNull: true,
},
isDelete: {
type: DataTypes.BOOLEAN,
defaultValue: false,
allowNull: false,
},
});
export default Notification;Editor is loading...