mirror of
https://github.com/cheveguerra/api-whatsapp-ts.git
synced 2026-04-18 19:59:28 +00:00
first
This commit is contained in:
24
src/application/lead.create.ts
Normal file
24
src/application/lead.create.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import LeadExternal from "../domain/lead.external";
|
||||
import LeadRepository from "../domain/lead.repository";
|
||||
|
||||
export class LeadCreate {
|
||||
private leadRepository: LeadRepository;
|
||||
private leadExternal: LeadExternal;
|
||||
constructor(respositories: [LeadRepository, LeadExternal]) {
|
||||
const [leadRepository, leadExternal] = respositories;
|
||||
this.leadRepository = leadRepository;
|
||||
this.leadExternal = leadExternal;
|
||||
}
|
||||
|
||||
public async sendMessageAndSave({
|
||||
message,
|
||||
phone,
|
||||
}: {
|
||||
message: string;
|
||||
phone: string;
|
||||
}) {
|
||||
const responseDbSave = await this.leadRepository.save({ message, phone });//TODO DB
|
||||
const responseExSave = await this.leadExternal.sendMsg({ message, phone });//TODO enviar a ws
|
||||
return {responseDbSave, responseExSave};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user