Added role
This commit is contained in:
parent
31cb674565
commit
6cb8402c97
|
|
@ -2,35 +2,42 @@ import { Role, PrismaClient } from "@prisma/client";
|
||||||
import { log } from "console";
|
import { log } from "console";
|
||||||
|
|
||||||
export default async function roleSeed(prisma: PrismaClient) {
|
export default async function roleSeed(prisma: PrismaClient) {
|
||||||
|
log("Seeding roles...");
|
||||||
|
|
||||||
log("Seeding roles...")
|
const roleData: Omit<Role, "id">[] = [
|
||||||
|
{
|
||||||
|
code: "super-admin",
|
||||||
|
description:
|
||||||
|
"Has full access to the system and can manage all features and settings",
|
||||||
|
isActive: true,
|
||||||
|
name: "Super Admin",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "reseller-office-365",
|
||||||
|
description: "Has ability to make request Office 365 links",
|
||||||
|
isActive: true,
|
||||||
|
name: "Reseller Office 365",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "admin-reseller-office-365",
|
||||||
|
description:
|
||||||
|
"Has ability to accept and provide links to Office 365 link request",
|
||||||
|
isActive: true,
|
||||||
|
name: "Admin Reseller Office 365",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const roleData: Omit<Role, "id">[] = [
|
await Promise.all(
|
||||||
{
|
roleData.map(async (role) => {
|
||||||
code: "super-admin",
|
await prisma.role.upsert({
|
||||||
description: "Has full access to the system and can manage all features and settings",
|
where: {
|
||||||
isActive: true,
|
code: role.code,
|
||||||
name: "Super Admin"
|
},
|
||||||
},
|
update: role,
|
||||||
{
|
create: role,
|
||||||
code: "reseller-office-365",
|
});
|
||||||
description: "Has ability to make request Office 365 links",
|
})
|
||||||
isActive: true,
|
);
|
||||||
name: "Reseller Office 365"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
await Promise.all(
|
console.log("roles is seeded successfully");
|
||||||
roleData.map(async (role) => {
|
|
||||||
await prisma.role.upsert({
|
|
||||||
where: {
|
|
||||||
code: role.code
|
|
||||||
},
|
|
||||||
update: role,
|
|
||||||
create: role
|
|
||||||
})
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
console.log("roles is seeded successfully")
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ const sidebarMenus: SidebarMenu[] = [
|
||||||
{
|
{
|
||||||
label: "My Request Links",
|
label: "My Request Links",
|
||||||
link: "/reseller-office-365/request",
|
link: "/reseller-office-365/request",
|
||||||
allowedRoles: ["*"]
|
allowedRoles: ["reseller-office-365"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Process Request Link",
|
label: "Process Request Link",
|
||||||
link: "/reseller-office-365/list",
|
link: "/reseller-office-365/list",
|
||||||
allowedRoles: ["*"]
|
allowedRoles: ["admin-reseller-office-365"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user