import { Deeds } from "@prisma/client"; import DeedsRepository from "@Repositories/DeedsRepository"; import BaseService from "@Services/BaseService"; import { Deed } from "le-coffre-resources/dist/SuperAdmin"; import { Service } from "typedi"; @Service() export default class DeedsService extends BaseService { constructor(private deedRepository: DeedsRepository) { super(); } /** * @description : Get all deeds * @throws {Error} If deeds cannot be get */ public async get(query: any) { return this.deedRepository.findMany(query); } /** * @description : Create a new deed with document types * @throws {Error} If deeds cannot be created */ public async create(deed: Deed): Promise { return this.deedRepository.create(deed); } /** * @description : Update data of a deed with document types * @throws {Error} If deeds cannot be updated with document types or one of them */ public async update(deeduid: string, deed: Deed): Promise { return this.deedRepository.update(deeduid, deed); } /** * @description : Get a deed by uid * @throws {Error} If deed-type cannot be get by uid */ public async getByUid(uid: string, query?: any): Promise { return this.deedRepository.findOneByUid(uid, query); } }