refactor(core): Use injectable classes for db repositories (part-1) (no-changelog) (#5953)
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
committed by
GitHub
parent
323e26acfd
commit
10f8c35dbb
@@ -51,7 +51,11 @@ function userToPayload(user: User): {
|
||||
export class InternalHooks implements IInternalHooksClass {
|
||||
private instanceId: string;
|
||||
|
||||
constructor(private telemetry: Telemetry, private nodeTypes: NodeTypes) {}
|
||||
constructor(
|
||||
private telemetry: Telemetry,
|
||||
private nodeTypes: NodeTypes,
|
||||
private roleService: RoleService,
|
||||
) {}
|
||||
|
||||
async init(instanceId: string) {
|
||||
this.instanceId = instanceId;
|
||||
@@ -155,7 +159,7 @@ export class InternalHooks implements IInternalHooksClass {
|
||||
|
||||
let userRole: 'owner' | 'sharee' | undefined = undefined;
|
||||
if (user.id && workflow.id) {
|
||||
const role = await RoleService.getUserRoleForWorkflow(user.id, workflow.id);
|
||||
const role = await this.roleService.getUserRoleForWorkflow(user.id, workflow.id);
|
||||
if (role) {
|
||||
userRole = role.name === 'owner' ? 'owner' : 'sharee';
|
||||
}
|
||||
@@ -342,8 +346,7 @@ export class InternalHooks implements IInternalHooksClass {
|
||||
|
||||
let userRole: 'owner' | 'sharee' | undefined = undefined;
|
||||
if (userId) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const role = await RoleService.getUserRoleForWorkflow(userId, workflow.id);
|
||||
const role = await this.roleService.getUserRoleForWorkflow(userId, workflow.id);
|
||||
if (role) {
|
||||
userRole = role.name === 'owner' ? 'owner' : 'sharee';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user