36 lines
1022 B
TypeScript
36 lines
1022 B
TypeScript
import BaseService from "@Services/BaseService";
|
|
import { Service } from "typedi";
|
|
import OfficeRolesRepository from "@Repositories/OfficeRolesRepository";
|
|
import { Prisma } from "@prisma/client";
|
|
|
|
@Service()
|
|
export default class OfficeRolesService extends BaseService {
|
|
constructor(private officeRoleRepository: OfficeRolesRepository) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* @description : Get all office roles
|
|
* @throws {Error} If office roles cannot be get
|
|
*/
|
|
public get(query: Prisma.OfficeRolesFindManyArgs) {
|
|
return this.officeRoleRepository.findMany(query);
|
|
}
|
|
|
|
/**
|
|
* @description : Get a officeRole by uid
|
|
* @throws {Error} If officeRole cannot be get by uid
|
|
*/
|
|
public getByUid(uid: string, query?: Prisma.OfficeRolesInclude) {
|
|
return this.officeRoleRepository.findOneByUid(uid, query);
|
|
}
|
|
|
|
/**
|
|
* @description : Get a officeRole by uid
|
|
* @throws {Error} If officeRole cannot be get by uid
|
|
*/
|
|
public getByUidWithOffice(uid: string) {
|
|
return this.officeRoleRepository.findOneByUidWithOffice(uid);
|
|
}
|
|
}
|