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,9 @@
import { ContactType } from '../../../Domain/Contact/ContactAggregate';
export interface CreateContactCommand {
name: string;
email: string;
userid?: string;
type: ContactType;
txt: string;
}
//# sourceMappingURL=CreateContactCommand.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CreateContactCommand.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/CreateContactCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=CreateContactCommand.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CreateContactCommand.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/CreateContactCommand.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
import { IContactRepository } from '../../../Domain/IRepository/IContactRepository';
import { CreateContactCommand } from './CreateContactCommand';
import { ShortContactDto } from '../../DTOs/ContactDto';
export declare class CreateContactCommandHandler {
private readonly contactRepo;
constructor(contactRepo: IContactRepository);
execute(cmd: CreateContactCommand): Promise<ShortContactDto>;
}
//# sourceMappingURL=CreateContactCommandHandler.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CreateContactCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/CreateContactCommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,qBAAa,2BAA2B;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAEtD,OAAO,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;CAgBnE"}
@@ -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
@@ -0,0 +1 @@
{"version":3,"file":"CreateContactCommandHandler.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/CreateContactCommandHandler.ts"],"names":[],"mappings":";;;AAGA,+EAA0F;AAC1F,oEAAiE;AAEjE,MAAa,2BAA2B;IACtC,YAA6B,WAA+B;QAA/B,gBAAW,GAAX,WAAW,CAAoB;IAAG,CAAC;IAEhE,KAAK,CAAC,OAAO,CAAC,GAAyB;QACrC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,mCAAgB,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YACxB,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;YAC1B,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC;YACpC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YACxB,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;YACtB,OAAO,CAAC,KAAK,GAAG,+BAAY,CAAC,MAAM,CAAC;YAEpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvD,OAAO,6BAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAnBD,kEAmBC"}
@@ -0,0 +1,5 @@
export interface DeleteContactCommand {
id: string;
hard?: boolean;
}
//# sourceMappingURL=DeleteContactCommand.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"DeleteContactCommand.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/DeleteContactCommand.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=DeleteContactCommand.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DeleteContactCommand.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/DeleteContactCommand.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
import { IContactRepository } from '../../../Domain/IRepository/IContactRepository';
import { DeleteContactCommand } from './DeleteContactCommand';
export declare class DeleteContactCommandHandler {
private readonly contactRepo;
constructor(contactRepo: IContactRepository);
execute(cmd: DeleteContactCommand): Promise<boolean>;
}
//# sourceMappingURL=DeleteContactCommandHandler.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"DeleteContactCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/DeleteContactCommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,qBAAa,2BAA2B;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAEtD,OAAO,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;CAiC3D"}
@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteContactCommandHandler = void 0;
const Logger_1 = require("../../Services/Logger");
class DeleteContactCommandHandler {
constructor(contactRepo) {
this.contactRepo = contactRepo;
}
async execute(cmd) {
try {
const existingContact = await this.contactRepo.findById(cmd.id);
if (!existingContact) {
throw new Error('Contact not found');
}
if (cmd.hard) {
// Permanent delete
await this.contactRepo.delete(cmd.id);
(0, Logger_1.logRequest)('Contact hard deleted', undefined, undefined, {
contactId: cmd.id,
contactEmail: existingContact.email,
deleteType: 'hard'
});
}
else {
// Soft delete (default)
await this.contactRepo.softDelete(cmd.id);
(0, Logger_1.logRequest)('Contact soft deleted', undefined, undefined, {
contactId: cmd.id,
contactEmail: existingContact.email,
deleteType: 'soft'
});
}
return true;
}
catch (error) {
if (error instanceof Error && error.message === 'Contact not found') {
throw error;
}
throw new Error('Failed to delete contact');
}
}
}
exports.DeleteContactCommandHandler = DeleteContactCommandHandler;
//# sourceMappingURL=DeleteContactCommandHandler.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DeleteContactCommandHandler.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/DeleteContactCommandHandler.ts"],"names":[],"mappings":";;;AAGA,kDAAmD;AAEnD,MAAa,2BAA2B;IACtC,YAA6B,WAA+B;QAA/B,gBAAW,GAAX,WAAW,CAAo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number;
respondedBy?: string;
}
//# sourceMappingURL=UpdateContactCommand.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"UpdateContactCommand.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/UpdateContactCommand.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=UpdateContactCommand.js.map
@@ -0,0 +1 @@
{"version":3,"file":"UpdateContactCommand.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/UpdateContactCommand.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
import { IContactRepository } from '../../../Domain/IRepository/IContactRepository';
import { UpdateContactCommand } from './UpdateContactCommand';
import { DetailContactDto } from '../../DTOs/ContactDto';
export declare class UpdateContactCommandHandler {
private readonly contactRepo;
constructor(contactRepo: IContactRepository);
execute(cmd: UpdateContactCommand): Promise<DetailContactDto>;
}
//# sourceMappingURL=UpdateContactCommandHandler.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"UpdateContactCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/UpdateContactCommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,qBAAa,2BAA2B;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAEtD,OAAO,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAmCpE"}
@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateContactCommandHandler = void 0;
const ContactMapper_1 = require("../../DTOs/Mappers/ContactMapper");
class UpdateContactCommandHandler {
constructor(contactRepo) {
this.contactRepo = contactRepo;
}
async execute(cmd) {
try {
const existingContact = await this.contactRepo.findById(cmd.id);
if (!existingContact) {
throw new Error('Contact not found');
}
const updateData = {};
if (cmd.adminResponse !== undefined) {
updateData.adminResponse = cmd.adminResponse;
updateData.responseDate = new Date();
}
if (cmd.state !== undefined) {
updateData.state = cmd.state;
}
if (cmd.respondedBy !== undefined) {
updateData.respondedBy = cmd.respondedBy;
}
const updated = await this.contactRepo.update(cmd.id, updateData);
if (!updated) {
throw new Error('Failed to update contact');
}
return ContactMapper_1.ContactMapper.toDetailDto(updated);
}
catch (error) {
if (error instanceof Error && error.message === 'Contact not found') {
throw error;
}
throw new Error('Failed to update contact');
}
}
}
exports.UpdateContactCommandHandler = UpdateContactCommandHandler;
//# sourceMappingURL=UpdateContactCommandHandler.js.map
@@ -0,0 +1 @@
{"version":3,"file":"UpdateContactCommandHandler.js","sourceRoot":"","sources":["../../../../src/Application/Contact/commands/UpdateContactCommandHandler.ts"],"names":[],"mappings":";;;AAGA,oEAAiE;AAGjE,MAAa,2BAA2B;IACtC,YAA6B,WAA+B;QAA/B,gBAAW,GAAX,WAAW,CAAoB;IAAG,CAAC;IAEhE,KAAK,CAAC,OAAO,CAAC,GAAyB;QACrC,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChE,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACvC,CAAC;YAED,MAAM,UAAU,GAAQ,EAAE,CAAC;YAE3B,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBACpC,UAAU,CA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