17 lines
504 B
TypeScript
17 lines
504 B
TypeScript
import { IOrganizationRepository } from '../../../Domain/IRepository/IOrganizationRepository';
|
|
import { DeleteOrganizationCommand } from './DeleteOrganizationCommand';
|
|
|
|
|
|
export class DeleteOrganizationCommandHandler {
|
|
constructor(private readonly orgRepo: IOrganizationRepository) {}
|
|
|
|
async execute(cmd: DeleteOrganizationCommand): Promise<boolean> {
|
|
if (cmd.soft) {
|
|
await this.orgRepo.softDelete(cmd.id);
|
|
} else {
|
|
await this.orgRepo.delete(cmd.id);
|
|
}
|
|
return true;
|
|
}
|
|
}
|