20 lines
698 B
JavaScript
20 lines
698 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.RejectComparisonCommand = void 0;
|
|
const Result_1 = require("../../../../shared/domain/Result");
|
|
class RejectComparisonCommand {
|
|
constructor(comparisonRepo) {
|
|
this.comparisonRepo = comparisonRepo;
|
|
}
|
|
async execute(req) {
|
|
const comparison = await this.comparisonRepo.findById(req.comparisonId);
|
|
if (!comparison) {
|
|
return (0, Result_1.Err)('Comparison not found');
|
|
}
|
|
comparison.reject();
|
|
await this.comparisonRepo.update(comparison);
|
|
return (0, Result_1.Ok)(undefined);
|
|
}
|
|
}
|
|
exports.RejectComparisonCommand = RejectComparisonCommand;
|