lecoffre-back/src/services/common/ContactService.ts
2023-07-04 18:09:45 +02:00

20 lines
618 B
TypeScript

import { Contacts, Customers } from "@prisma/client";
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
import ContactRepository from "@Repositories/ContactRepository";
@Service()
export default class DocumentsService extends BaseService {
constructor(private contactRepository: ContactRepository) {
super();
}
/**
* @description : Get a contact by email
* @throws {Error} If contact cannot be get by email
*/
public async getByEmail(email: string): Promise<(Contacts & {customers: Customers | null}) | null> {
return this.contactRepository.findOneByEmail(email);
}
}