AdministratorService

AdministratorService

Contains methods relating to Administrator entities.

Signature

class AdministratorService {
  constructor(connection: TransactionalConnection, configService: ConfigService, listQueryBuilder: ListQueryBuilder, passwordCipher: PasswordCipher, userService: UserService, roleService: RoleService, customFieldRelationService: CustomFieldRelationService)
  findAll(ctx: RequestContext, options?: ListQueryOptions<Administrator>) => Promise<PaginatedList<Administrator>>;
  findOne(ctx: RequestContext, administratorId: ID) => Promise<Administrator | undefined>;
  findOneByUserId(ctx: RequestContext, userId: ID) => Promise<Administrator | undefined>;
  async create(ctx: RequestContext, input: CreateAdministratorInput) => Promise<Administrator>;
  async update(ctx: RequestContext, input: UpdateAdministratorInput) => Promise<Administrator>;
  async assignRole(ctx: RequestContext, administratorId: ID, roleId: ID) => Promise<Administrator>;
  async softDelete(ctx: RequestContext, id: ID) => ;
}

Members

constructor

method
type:
(connection: TransactionalConnection, configService: ConfigService, listQueryBuilder: ListQueryBuilder, passwordCipher: PasswordCipher, userService: UserService, roleService: RoleService, customFieldRelationService: CustomFieldRelationService) => AdministratorService

findAll

method
type:
(ctx: RequestContext, options?: ListQueryOptions<Administrator>) => Promise<PaginatedList<Administrator>>
Get a paginated list of Administrators.

findOne

method
type:
(ctx: RequestContext, administratorId: ID) => Promise<Administrator | undefined>
Get an Administrator by id.

findOneByUserId

method
type:
(ctx: RequestContext, userId: ID) => Promise<Administrator | undefined>
Get an Administrator based on the User id.

create

async method
type:
(ctx: RequestContext, input: CreateAdministratorInput) => Promise<Administrator>
Create a new Administrator.

update

async method
type:
(ctx: RequestContext, input: UpdateAdministratorInput) => Promise<Administrator>
Update an existing Administrator.

assignRole

async method
type:
(ctx: RequestContext, administratorId: ID, roleId: ID) => Promise<Administrator>
Assigns a Role to the Administrator’s User entity.

softDelete

async method
type:
(ctx: RequestContext, id: ID) =>
Soft deletes an Administrator (sets the deletedAt field).