2023-09-29 00:32:19 +02:00

40 lines
1.0 KiB
TypeScript

import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository";
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
import { Prisma } from "@prisma/client";
@Service()
export default class OfficeFoldersService extends BaseService {
constructor(
private officeFoldersRepository: OfficeFoldersRepository,
) {
super();
}
/**
* @description : Get all folders
* @throws {Error} If folders cannot be get
*/
public async get(query: Prisma.OfficeFoldersFindManyArgs) {
return this.officeFoldersRepository.findMany(query);
}
/**
* @description : Get a folder by uid
* @throws {Error} If folder cannot be get by uid
*/
public async getByUid(uid: string, query?: Prisma.OfficeFoldersInclude) {
return this.officeFoldersRepository.findOneByUid(uid, query);
}
/**
* @description : Get a folder by uid
* @throws {Error} If folder cannot be get by uid
*/
public async getByUidWithCustomers(uid: string) {
return this.officeFoldersRepository.findOneByUidWithCustomers(uid);
}
}