%PDF- %PDF-
Direktori : /home/opti/workflow/src/models/ |
Current File : /home/opti/workflow/src/models/notification.js |
'use strict'; module.exports = (sequelize, DataTypes) => { const Notification = sequelize.define('Notification', { uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4 }, senderId: DataTypes.INTEGER, receiverId: DataTypes.INTEGER, type: DataTypes.STRING, notifiableId: DataTypes.INTEGER, seen: DataTypes.INTEGER, message: DataTypes.STRING, url: DataTypes.STRING }, {}); Notification.associate = function(models) { // associations can be defined here Notification.belongsTo(models.User, {foreignKey: 'senderId', targetKey: 'id', as: 'sender'}); Notification.belongsTo(models.User, {foreignKey: 'receiverId', targetKey: 'id', as: 'receiver'}); }; return Notification; };