import BaseService from "@Services/BaseService"; import { Service } from "typedi"; import OfficeRolesRepository from "@Repositories/OfficeRolesRepository"; import { OfficeRole } from "le-coffre-resources/dist/Admin"; import { Prisma, OfficeRoles } from "@prisma/client"; @Service() export default class OfficeRolesService extends BaseService { constructor(private officeRoleRepository: OfficeRolesRepository) { super(); } /** * @description : Get all officeRoles * @throws {Error} If officeRoles cannot be get */ public get(query: Prisma.OfficeRolesFindManyArgs) { return this.officeRoleRepository.findMany(query); } /** * @description : Create a officeRole * @throws {Error} If officeRole couldn't be created */ public create(officeRoleEntity: OfficeRole): Promise { return this.officeRoleRepository.create(officeRoleEntity); } /** * @description : Modify a officeRole * @throws {Error} If officeRole modification failed */ public update(officeRoleEntity: OfficeRole): Promise { return this.officeRoleRepository.update(officeRoleEntity); } /** * @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); } }