28 lines
724 B
TypeScript
28 lines
724 B
TypeScript
import BaseService from "@Services/BaseService";
|
|
import { Service } from "typedi";
|
|
import RolesRepository from "@Repositories/RolesRepository";
|
|
import { Prisma } from "@prisma/client";
|
|
|
|
@Service()
|
|
export default class RolesService extends BaseService {
|
|
constructor(private roleRepository: RolesRepository) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* @description : Get all roles
|
|
* @throws {Error} If roles cannot be get
|
|
*/
|
|
public get(query: Prisma.RolesFindManyArgs) {
|
|
return this.roleRepository.findMany(query);
|
|
}
|
|
|
|
/**
|
|
* @description : Get a role by uid
|
|
* @throws {Error} If role cannot be get by uid
|
|
*/
|
|
public getByUid(uid: string, query?: Prisma.RolesInclude) {
|
|
return this.roleRepository.findOneByUid(uid, query);
|
|
}
|
|
}
|