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 + } }