22 lines
802 B
JavaScript
22 lines
802 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.DeleteScheduleCommand = void 0;
|
|
const Result_1 = require("../../../../shared/domain/Result");
|
|
const UniqueId_1 = require("../../../../shared/domain/UniqueId");
|
|
class DeleteScheduleCommand {
|
|
constructor(scheduleRepo, eventBus) {
|
|
this.scheduleRepo = scheduleRepo;
|
|
this.eventBus = eventBus;
|
|
}
|
|
async execute(req) {
|
|
const id = UniqueId_1.UniqueId.from(req.id);
|
|
const schedule = await this.scheduleRepo.findById(id);
|
|
if (!schedule)
|
|
return (0, Result_1.Err)('Schedule not found');
|
|
await this.scheduleRepo.delete(id);
|
|
void this.eventBus;
|
|
return (0, Result_1.Ok)(undefined);
|
|
}
|
|
}
|
|
exports.DeleteScheduleCommand = DeleteScheduleCommand;
|