fase(15): reporting module with pdf generation
This commit is contained in:
14
dist/modules/reporting/domain/value-objects/DateRange.js
vendored
Normal file
14
dist/modules/reporting/domain/value-objects/DateRange.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DateRange = void 0;
|
||||
const ValueObject_1 = require("../../../../shared/domain/ValueObject");
|
||||
class DateRange extends ValueObject_1.ValueObject {
|
||||
get startDate() { return this.props.startDate; }
|
||||
get endDate() { return this.props.endDate; }
|
||||
static create(startDate, endDate) {
|
||||
if (startDate > endDate)
|
||||
throw new Error('startDate must be before endDate');
|
||||
return new DateRange({ startDate, endDate });
|
||||
}
|
||||
}
|
||||
exports.DateRange = DateRange;
|
||||
17
dist/modules/reporting/domain/value-objects/ReportFormat.js
vendored
Normal file
17
dist/modules/reporting/domain/value-objects/ReportFormat.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReportFormat = void 0;
|
||||
const ValueObject_1 = require("../../../../shared/domain/ValueObject");
|
||||
class ReportFormat extends ValueObject_1.ValueObject {
|
||||
get value() { return this.props.value; }
|
||||
static html() { return new ReportFormat({ value: 'html' }); }
|
||||
static json() { return new ReportFormat({ value: 'json' }); }
|
||||
static pdf() { return new ReportFormat({ value: 'pdf' }); }
|
||||
static fromString(s) {
|
||||
if (s === 'html' || s === 'json' || s === 'pdf') {
|
||||
return new ReportFormat({ value: s });
|
||||
}
|
||||
throw new Error(`Invalid report format: ${s}`);
|
||||
}
|
||||
}
|
||||
exports.ReportFormat = ReportFormat;
|
||||
18
dist/modules/reporting/domain/value-objects/ReportStatus.js
vendored
Normal file
18
dist/modules/reporting/domain/value-objects/ReportStatus.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReportStatus = void 0;
|
||||
const ValueObject_1 = require("../../../../shared/domain/ValueObject");
|
||||
class ReportStatus extends ValueObject_1.ValueObject {
|
||||
get value() { return this.props.value; }
|
||||
static pending() { return new ReportStatus({ value: 'pending' }); }
|
||||
static generating() { return new ReportStatus({ value: 'generating' }); }
|
||||
static ready() { return new ReportStatus({ value: 'ready' }); }
|
||||
static failed() { return new ReportStatus({ value: 'failed' }); }
|
||||
static fromString(s) {
|
||||
if (s === 'pending' || s === 'generating' || s === 'ready' || s === 'failed') {
|
||||
return new ReportStatus({ value: s });
|
||||
}
|
||||
throw new Error(`Invalid report status: ${s}`);
|
||||
}
|
||||
}
|
||||
exports.ReportStatus = ReportStatus;
|
||||
Reference in New Issue
Block a user