Raw
1 import { model } from "@medusajs/framework/utils"
2 import RbacPolicy from "./rbac-policy"
3 import RbacRole from "./rbac-role"
4
5 const RbacRolePolicy = model
6 .define("rbac_role_policy", {
7 id: model.id({ prefix: "rlpl" }).primaryKey(),
8 role: model.belongsTo(() => RbacRole),
9 policy: model.belongsTo(() => RbacPolicy),
10 metadata: model.json().nullable(),
11 })
12 .indexes([
13 {
14 on: ["role_id"],
15 where: "deleted_at IS NULL",
16 },
17 {
18 on: ["policy_id"],
19 where: "deleted_at IS NULL",
20 },
21 {
22 on: ["role_id", "policy_id"],
23 unique: true,
24 where: "deleted_at IS NULL",
25 },
26 ])
27
28 export default RbacRolePolicy