28 lines
755 B
TypeScript
28 lines
755 B
TypeScript
import { Prisma } from "@prisma/client";
|
|
import OfficesRepository from "@Repositories/OfficesRepository";
|
|
import BaseService from "@Services/BaseService";
|
|
import { Service } from "typedi";
|
|
|
|
@Service()
|
|
export default class OfficesService extends BaseService {
|
|
constructor(private officeRepository: OfficesRepository) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* @description : Get all offices
|
|
* @throws {Error} If offices cannot be get
|
|
*/
|
|
public async get(query: Prisma.OfficesFindManyArgs) {
|
|
return this.officeRepository.findMany(query);
|
|
}
|
|
|
|
/**
|
|
* @description : Get a office by uid
|
|
* @throws {Error} If office cannot be get
|
|
*/
|
|
public async getByUid(uid: string, query?: Prisma.OfficesInclude) {
|
|
return this.officeRepository.findOneByUid(uid, query);
|
|
}
|
|
}
|