feat: added roles and permissions models

This commit is contained in:
Sathishkumar Krishnan
2021-12-23 18:36:12 +05:30
parent 7b1eadc381
commit 75115c050c
3 changed files with 72 additions and 22 deletions

24
src/models/UserRole.js Normal file
View File

@@ -0,0 +1,24 @@
const mongoose = require("mongoose");
const schema = new mongoose.Schema(
{
name: {
type: String,
required: true,
trim: true,
},
permissions: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "UserPermission",
},
],
},
{
timestamps: true,
}
);
const UserRole = mongoose.model("UserRole", schema);
module.exports = UserRole;