chore(rbac): user link and utils (#14320)
This commit is contained in:
committed by
GitHub
parent
7161cf1903
commit
b2245cc672
@@ -1,5 +1,6 @@
|
||||
export * from "./cart-payment-collection"
|
||||
export * from "./cart-promotion"
|
||||
export * from "./customer-account-holder"
|
||||
export * from "./fulfillment-provider-location"
|
||||
export * from "./fulfillment-set-location"
|
||||
export * from "./order-cart"
|
||||
@@ -8,6 +9,7 @@ export * from "./order-payment-collection"
|
||||
export * from "./order-promotion"
|
||||
export * from "./order-return-fulfillment"
|
||||
export * from "./product-sales-channel"
|
||||
export * from "./product-shipping-profile"
|
||||
export * from "./product-variant-inventory-item"
|
||||
export * from "./product-variant-price-set"
|
||||
export * from "./publishable-api-key-sales-channel"
|
||||
@@ -15,5 +17,4 @@ export * from "./readonly"
|
||||
export * from "./region-payment-provider"
|
||||
export * from "./sales-channel-location"
|
||||
export * from "./shipping-option-price-set"
|
||||
export * from "./product-shipping-profile"
|
||||
export * from "./customer-account-holder"
|
||||
export * from "./user-rbac-role"
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { ModuleJoinerConfig } from "@medusajs/framework/types"
|
||||
import { LINKS, Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export const UserRbacRole: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.UserRbacRole,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "user_rbac_role",
|
||||
idPrefix: "userrole",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: "user_rbac_role",
|
||||
},
|
||||
{
|
||||
name: "user_rbac_roles",
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "user_id", "rbac_role_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.USER,
|
||||
entity: "User",
|
||||
primaryKey: "id",
|
||||
foreignKey: "user_id",
|
||||
alias: "user",
|
||||
args: {
|
||||
methodSuffix: "Users",
|
||||
},
|
||||
hasMany: true,
|
||||
},
|
||||
{
|
||||
serviceName: Modules.RBAC,
|
||||
entity: "RbacRole",
|
||||
primaryKey: "id",
|
||||
foreignKey: "rbac_role_id",
|
||||
alias: "rbac_role",
|
||||
args: {
|
||||
methodSuffix: "RbacRoles",
|
||||
},
|
||||
hasMany: true,
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.USER,
|
||||
entity: "User",
|
||||
fieldAlias: {
|
||||
rbac_roles: {
|
||||
path: "rbac_roles_link.rbac_role",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.UserRbacRole,
|
||||
primaryKey: "user_id",
|
||||
foreignKey: "id",
|
||||
alias: "rbac_roles_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.RBAC,
|
||||
entity: "RbacRole",
|
||||
relationship: {
|
||||
serviceName: LINKS.UserRbacRole,
|
||||
primaryKey: "rbac_role_id",
|
||||
foreignKey: "id",
|
||||
alias: "users_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user