From e64d0a8c0246d8d6d616513cbcc917f2cda42d8b Mon Sep 17 00:00:00 2001 From: AntoXa PRO Date: Thu, 6 Jun 2024 14:43:27 +0300 Subject: [PATCH] add roles serveces --- package.json | 2 +- src/services/factory.ts | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8f1110d..ae046c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "directus-helpers", - "version": "1.3.0", + "version": "1.4.0", "description": "Helpers Directus Extensions", "author": "AntoXa PRO ", "homepage": "https://antoxahub.ru/antoxa/directus-helpers", diff --git a/src/services/factory.ts b/src/services/factory.ts index 7d63f3f..c744b25 100644 --- a/src/services/factory.ts +++ b/src/services/factory.ts @@ -2,7 +2,8 @@ import type { SchemaOverview, Accountability } from '@directus/types' import type { ItemsService, FilesService, - UsersService + UsersService, + RolesService } from '@directus/api/dist/services' export type TFactoryServicesOpts = { @@ -20,6 +21,7 @@ export class FactoryServices { private _items: Partial> = {} private _files: FilesService | null = null private _users: UsersService | null = null + private _roles: RolesService | null = null constructor(opts: TFactoryServicesOpts) { this.opts = opts @@ -49,11 +51,21 @@ export class FactoryServices { get users() { if (!this._users) { - this._users = new this.opts.services.UserService({ + this._users = new this.opts.services.UsersService({ schema: this.opts.schema, accountability: this.opts.accountability }) } return this._users as UsersService } + + get roles() { + if (!this._roles) { + this._roles = new this.opts.services.RolesService({ + schema: this.opts.schema, + accountability: this.opts.accountability + }) + } + return this._roles as RolesService + } }