https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateContactCommandHandler = void 0;
const ContactAggregate_1 = require("../../../Domain/Contact/ContactAggregate");
const ContactMapper_1 = require("../../DTOs/Mappers/ContactMapper");
class CreateContactCommandHandler {
constructor(contactRepo) {
this.contactRepo = contactRepo;
}
async execute(cmd) {
try {
const contact = new ContactAggregate_1.ContactAggregate();
contact.name = cmd.name;
contact.email = cmd.email;
contact.userid = cmd.userid || null;
contact.type = cmd.type;
contact.txt = cmd.txt;
contact.state = ContactAggregate_1.ContactState.ACTIVE;
const created = await this.contactRepo.create(contact);
return ContactMapper_1.ContactMapper.toShortDto(created);
}
catch (error) {
throw new Error('Failed to create contact');
}
}
}
exports.CreateContactCommandHandler = CreateContactCommandHandler;
//# sourceMappingURL=CreateContactCommandHandler.js.map