first commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 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/permission/rolePermission.model.js
|
||||
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const rolePermission = sequelize.define(
|
||||
"rolePermission",
|
||||
{
|
||||
rp_id: {
|
||||
type: DataTypes.STRING,
|
||||
primaryKey: true
|
||||
},
|
||||
role_id: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
permission_id: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: "rolePermission",
|
||||
timestamps: true
|
||||
}
|
||||
);
|
||||
|
||||
rolePermission.associate = (db) => {
|
||||
rolePermission.belongsTo(db.roles, {
|
||||
foreignKey: "role_id",
|
||||
as: "role"
|
||||
});
|
||||
rolePermission.belongsTo(db.permission, {
|
||||
foreignKey: "permission_id",
|
||||
as: "permission"
|
||||
});
|
||||
};
|
||||
|
||||
return rolePermission;
|
||||
};
|
||||
Reference in New Issue
Block a user