@fiado/type-kit 3.516.0 → 3.517.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_test_/unit/rewardsEligibility/backofficeBarrel.test.ts +16 -0
- package/_test_/unit/rewardsEligibility/campaignAndEventTypeDtos.test.ts +52 -0
- package/_test_/unit/rewardsEligibility/campaignConfigDecorators.test.ts +49 -0
- package/_test_/unit/rewardsEligibility/catalogDtos.test.ts +27 -0
- package/_test_/unit/rewardsEligibility/evaluationDtos.test.ts +53 -0
- package/_test_/unit/rewardsEligibility/events.test.ts +3 -3
- package/_test_/unit/rewardsEligibility/metricsDtos.test.ts +17 -0
- package/_test_/unit/rewardsEligibility/runDtos.test.ts +36 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.d.ts +12 -0
- package/bin/rewardsEligibility/constants/BackofficeLimits.js +15 -0
- package/bin/rewardsEligibility/dtos/CampaignAlerts.js +20 -0
- package/bin/rewardsEligibility/dtos/CampaignQuota.d.ts +1 -1
- package/bin/rewardsEligibility/dtos/CampaignQuota.js +29 -0
- package/bin/rewardsEligibility/dtos/backoffice/ApproveRunRequest.d.ts +4 -0
- package/bin/rewardsEligibility/dtos/backoffice/ApproveRunRequest.js +27 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignListResponse.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignRequest.d.ts +16 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignRequest.js +72 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignResponse.d.ts +23 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.d.ts +28 -0
- package/bin/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunRequest.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunRequest.js +45 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunResponse.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/CreateRunResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.d.ts +27 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationRequest.js +86 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationResponse.d.ts +26 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeRequest.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeRequest.js +58 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeResponse.d.ts +12 -0
- package/bin/rewardsEligibility/dtos/backoffice/EventTypeResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/InputTypeResponse.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/InputTypeResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsPointResponse.d.ts +14 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsPointResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsQuery.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/MetricsQuery.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationRunRequest.js +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.d.ts +9 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.d.ts +10 -0
- package/bin/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/ResultTraceResponse.d.ts +34 -0
- package/bin/rewardsEligibility/dtos/backoffice/ResultTraceResponse.js +14 -0
- package/bin/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.d.ts +28 -0
- package/bin/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.js +13 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResponse.d.ts +24 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultListResponse.d.ts +5 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultListResponse.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultResponse.d.ts +22 -0
- package/bin/rewardsEligibility/dtos/backoffice/RunResultResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateRequest.d.ts +8 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateRequest.js +40 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateResponse.d.ts +11 -0
- package/bin/rewardsEligibility/dtos/backoffice/SimulateResponse.js +6 -0
- package/bin/rewardsEligibility/enums/MetricsDimensionEnum.d.ts +8 -0
- package/bin/rewardsEligibility/enums/MetricsDimensionEnum.js +12 -0
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.d.ts +46 -1
- package/bin/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.js +46 -0
- package/bin/rewardsEligibility/enums/RuleValueTypeEnum.d.ts +9 -0
- package/bin/rewardsEligibility/enums/RuleValueTypeEnum.js +13 -0
- package/bin/rewardsEligibility/index.d.ts +34 -0
- package/bin/rewardsEligibility/index.js +35 -0
- package/package.json +1 -1
- package/src/rewardsEligibility/constants/BackofficeLimits.ts +12 -0
- package/src/rewardsEligibility/dtos/CampaignAlerts.ts +9 -0
- package/src/rewardsEligibility/dtos/CampaignQuota.ts +13 -1
- package/src/rewardsEligibility/dtos/backoffice/ApproveRunRequest.ts +13 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignListResponse.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignRequest.ts +53 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignResponse.ts +24 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignStatusRequest.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/CampaignSummaryResponse.ts +26 -0
- package/src/rewardsEligibility/dtos/backoffice/CreateRunRequest.ts +30 -0
- package/src/rewardsEligibility/dtos/backoffice/CreateRunResponse.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationRequest.ts +69 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationResponse.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/EvaluationStatusRequest.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeRequest.ts +41 -0
- package/src/rewardsEligibility/dtos/backoffice/EventTypeResponse.ts +13 -0
- package/src/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.ts +8 -0
- package/src/rewardsEligibility/dtos/backoffice/InputTypeResponse.ts +7 -0
- package/src/rewardsEligibility/dtos/backoffice/MetricsPointResponse.ts +14 -0
- package/src/rewardsEligibility/dtos/backoffice/MetricsQuery.ts +10 -0
- package/src/rewardsEligibility/dtos/backoffice/PopulationRunRequest.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/PopulationSourceResponse.ts +12 -0
- package/src/rewardsEligibility/dtos/backoffice/QuotaImpactResponse.ts +9 -0
- package/src/rewardsEligibility/dtos/backoffice/QuotaUsageResponse.ts +11 -0
- package/src/rewardsEligibility/dtos/backoffice/ResultTraceResponse.ts +34 -0
- package/src/rewardsEligibility/dtos/backoffice/RuleCatalogResponse.ts +28 -0
- package/src/rewardsEligibility/dtos/backoffice/RunListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResponse.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResultListResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/RunResultResponse.ts +23 -0
- package/src/rewardsEligibility/dtos/backoffice/SimulateRequest.ts +25 -0
- package/src/rewardsEligibility/dtos/backoffice/SimulateResponse.ts +12 -0
- package/src/rewardsEligibility/enums/MetricsDimensionEnum.ts +8 -0
- package/src/rewardsEligibility/enums/RewardsEligibilityErrorCodeEnum.ts +47 -0
- package/src/rewardsEligibility/enums/RuleValueTypeEnum.ts +9 -0
- package/src/rewardsEligibility/index.ts +36 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleCatalogResponse = exports.RuleCatalogSourceResponse = exports.RuleCatalogFieldResponse = void 0;
|
|
4
|
+
/** Un campo que una fuente resuelve para las reglas (`GET /rule-catalog`). */
|
|
5
|
+
class RuleCatalogFieldResponse {
|
|
6
|
+
}
|
|
7
|
+
exports.RuleCatalogFieldResponse = RuleCatalogFieldResponse;
|
|
8
|
+
class RuleCatalogSourceResponse {
|
|
9
|
+
}
|
|
10
|
+
exports.RuleCatalogSourceResponse = RuleCatalogSourceResponse;
|
|
11
|
+
class RuleCatalogResponse {
|
|
12
|
+
}
|
|
13
|
+
exports.RuleCatalogResponse = RuleCatalogResponse;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ApprovalModeEnum } from '../../enums/ApprovalModeEnum';
|
|
2
|
+
import { RunModeEnum } from '../../enums/RunModeEnum';
|
|
3
|
+
import { RunStatusEnum } from '../../enums/RunStatusEnum';
|
|
4
|
+
import { TriggerTypeEnum } from '../../enums/TriggerTypeEnum';
|
|
5
|
+
import { RunCounts } from '../RunCounts';
|
|
6
|
+
import { QuotaImpactResponse } from './QuotaImpactResponse';
|
|
7
|
+
/** Corrida para el backoffice (spec 10). */
|
|
8
|
+
export declare class RunResponse {
|
|
9
|
+
id: string;
|
|
10
|
+
evaluationId: string;
|
|
11
|
+
/** `version` de la evaluación CONGELADA en la corrida. */
|
|
12
|
+
evaluationVersion: number;
|
|
13
|
+
campaignId: string;
|
|
14
|
+
trigger: TriggerTypeEnum;
|
|
15
|
+
approval: ApprovalModeEnum;
|
|
16
|
+
mode: RunModeEnum;
|
|
17
|
+
status: RunStatusEnum;
|
|
18
|
+
counts: RunCounts;
|
|
19
|
+
/** Solo con `status: AWAITING_APPROVAL`: cuánto consumiría la corrida de cada cupo y cuánto queda. */
|
|
20
|
+
quotaImpact?: QuotaImpactResponse[];
|
|
21
|
+
requestedBy: string;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DynamicFormValue } from '../../../dynamicForm/types/DynamicFormValue';
|
|
2
|
+
import { EvaluationOutcomeEnum } from '../../enums/EvaluationOutcomeEnum';
|
|
3
|
+
import { GrantRequestStatusEnum } from '../../enums/GrantRequestStatusEnum';
|
|
4
|
+
import { ResultTraceResponse } from './ResultTraceResponse';
|
|
5
|
+
/** Resultado por sujeto CON traza e inputs (spec 5.4). */
|
|
6
|
+
export declare class RunResultResponse {
|
|
7
|
+
runId: string;
|
|
8
|
+
subjectKey: string;
|
|
9
|
+
inputs: Record<string, DynamicFormValue>;
|
|
10
|
+
beneficiaryDirectoryId: string;
|
|
11
|
+
campaignId: string;
|
|
12
|
+
evaluationId: string;
|
|
13
|
+
packageId: string;
|
|
14
|
+
outcome: EvaluationOutcomeEnum;
|
|
15
|
+
trace?: ResultTraceResponse;
|
|
16
|
+
grantKey?: string;
|
|
17
|
+
grantStatus: GrantRequestStatusEnum;
|
|
18
|
+
/** Cruza con `GET /grants/{id}` de rewards. */
|
|
19
|
+
grantId?: string;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
evaluatedAt: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DynamicFormValue } from '../../../dynamicForm/types/DynamicFormValue';
|
|
2
|
+
import { EvaluationRequest } from './EvaluationRequest';
|
|
3
|
+
/** `POST /evaluations/simulate`: una evaluación GUARDADA (`evaluationId`) o un BORRADOR sin guardar (`evaluation`), más los inputs del sujeto. No persiste nada. Exactamente uno de los dos lo valida el lambda. */
|
|
4
|
+
export declare class SimulateRequest {
|
|
5
|
+
evaluationId?: string;
|
|
6
|
+
evaluation?: EvaluationRequest;
|
|
7
|
+
inputs: Record<string, DynamicFormValue>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SimulateRequest = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const IsDynamicFormValues_1 = require("../../../dynamicForm/validators/IsDynamicFormValues");
|
|
16
|
+
const BackofficeLimits_1 = require("../../constants/BackofficeLimits");
|
|
17
|
+
const EvaluationRequest_1 = require("./EvaluationRequest");
|
|
18
|
+
/** `POST /evaluations/simulate`: una evaluación GUARDADA (`evaluationId`) o un BORRADOR sin guardar (`evaluation`), más los inputs del sujeto. No persiste nada. Exactamente uno de los dos lo valida el lambda. */
|
|
19
|
+
class SimulateRequest {
|
|
20
|
+
}
|
|
21
|
+
exports.SimulateRequest = SimulateRequest;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_transformer_1.Expose)(),
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.Matches)(BackofficeLimits_1.ELIGIBILITY_ID_PATTERN),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], SimulateRequest.prototype, "evaluationId", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_transformer_1.Expose)(),
|
|
31
|
+
(0, class_validator_1.IsOptional)(),
|
|
32
|
+
(0, class_validator_1.ValidateNested)(),
|
|
33
|
+
(0, class_transformer_1.Type)(() => EvaluationRequest_1.EvaluationRequest),
|
|
34
|
+
__metadata("design:type", EvaluationRequest_1.EvaluationRequest)
|
|
35
|
+
], SimulateRequest.prototype, "evaluation", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_transformer_1.Expose)(),
|
|
38
|
+
(0, class_validator_1.Validate)(IsDynamicFormValues_1.IsDynamicFormValues),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], SimulateRequest.prototype, "inputs", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EvaluationOutcomeEnum } from '../../enums/EvaluationOutcomeEnum';
|
|
2
|
+
import { ResultTraceResponse } from './ResultTraceResponse';
|
|
3
|
+
export declare class SimulateResponse {
|
|
4
|
+
outcome: EvaluationOutcomeEnum;
|
|
5
|
+
/** Ausente si el sujeto ni siquiera pudo evaluarse (inputs inválidos). */
|
|
6
|
+
trace?: ResultTraceResponse;
|
|
7
|
+
beneficiaryDirectoryId?: string;
|
|
8
|
+
grantKey?: string;
|
|
9
|
+
/** Explicación corta: «Ya recibió el premio para la venta s-9». */
|
|
10
|
+
note?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Dimensión de las métricas preagregadas (spec 5.7). `ALL` suma todas las campañas al consultar (no se escribe). */
|
|
2
|
+
export declare enum MetricsDimensionEnum {
|
|
3
|
+
CAMPAIGN = "CAMPAIGN",
|
|
4
|
+
EVALUATION = "EVALUATION",
|
|
5
|
+
PACKAGE = "PACKAGE",
|
|
6
|
+
TRIGGER = "TRIGGER",
|
|
7
|
+
ALL = "ALL"
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetricsDimensionEnum = void 0;
|
|
4
|
+
/** Dimensión de las métricas preagregadas (spec 5.7). `ALL` suma todas las campañas al consultar (no se escribe). */
|
|
5
|
+
var MetricsDimensionEnum;
|
|
6
|
+
(function (MetricsDimensionEnum) {
|
|
7
|
+
MetricsDimensionEnum["CAMPAIGN"] = "CAMPAIGN";
|
|
8
|
+
MetricsDimensionEnum["EVALUATION"] = "EVALUATION";
|
|
9
|
+
MetricsDimensionEnum["PACKAGE"] = "PACKAGE";
|
|
10
|
+
MetricsDimensionEnum["TRIGGER"] = "TRIGGER";
|
|
11
|
+
MetricsDimensionEnum["ALL"] = "ALL";
|
|
12
|
+
})(MetricsDimensionEnum || (exports.MetricsDimensionEnum = MetricsDimensionEnum = {}));
|
|
@@ -4,5 +4,50 @@ export declare enum RewardsEligibilityErrorCodeEnum {
|
|
|
4
4
|
/** 404: el eventKey no existe o está inactivo. */
|
|
5
5
|
EVENT_TYPE_NOT_FOUND = "EVENT_TYPE_NOT_FOUND",
|
|
6
6
|
/** 404: GET /runs/{id} sin corrida. */
|
|
7
|
-
RUN_NOT_FOUND = "RUN_NOT_FOUND"
|
|
7
|
+
RUN_NOT_FOUND = "RUN_NOT_FOUND",
|
|
8
|
+
/** 400: el cuerpo no cumple el DTO (solo nombres de propiedad, nunca valores). */
|
|
9
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
10
|
+
/** 400: `limit` fuera de rango o `cursor` que no devolvió esta API. */
|
|
11
|
+
INVALID_PAGE = "INVALID_PAGE",
|
|
12
|
+
/** 400: un filtro de query (`outcome`, `status`, `dimension`, fechas…) no es válido. */
|
|
13
|
+
INVALID_FILTER = "INVALID_FILTER",
|
|
14
|
+
/** 503: el índice de listado aún no existe en la tabla (pendiente de infraestructura). */
|
|
15
|
+
LIST_INDEX_NOT_AVAILABLE = "LIST_INDEX_NOT_AVAILABLE",
|
|
16
|
+
/** 409: otra persona editó la misma fila. */
|
|
17
|
+
VERSION_CONFLICT = "VERSION_CONFLICT",
|
|
18
|
+
/** 400: el id de la ruta no coincide con el del cuerpo. */
|
|
19
|
+
REQUEST_ID_MISMATCH = "REQUEST_ID_MISMATCH",
|
|
20
|
+
/** 409: la transición de estado no está permitida. */
|
|
21
|
+
INVALID_STATUS_TRANSITION = "INVALID_STATUS_TRANSITION",
|
|
22
|
+
CAMPAIGN_NOT_FOUND = "CAMPAIGN_NOT_FOUND",
|
|
23
|
+
CAMPAIGN_ALREADY_EXISTS = "CAMPAIGN_ALREADY_EXISTS",
|
|
24
|
+
CAMPAIGN_INVALID = "CAMPAIGN_INVALID",
|
|
25
|
+
EVALUATION_NOT_FOUND = "EVALUATION_NOT_FOUND",
|
|
26
|
+
EVALUATION_ALREADY_EXISTS = "EVALUATION_ALREADY_EXISTS",
|
|
27
|
+
/** 400: la evaluación no pasa las validaciones del spec 5.1 (lista TODOS los problemas). */
|
|
28
|
+
EVALUATION_INVALID = "EVALUATION_INVALID",
|
|
29
|
+
/** 409: la evaluación o su campaña no están en condiciones de correr (estado o vigencia). */
|
|
30
|
+
EVALUATION_NOT_RUNNABLE = "EVALUATION_NOT_RUNNABLE",
|
|
31
|
+
EVENT_TYPE_ALREADY_EXISTS = "EVENT_TYPE_ALREADY_EXISTS",
|
|
32
|
+
EVENT_TYPE_INVALID = "EVENT_TYPE_INVALID",
|
|
33
|
+
/** 409: el tipo de evento lo escuchan evaluaciones ACTIVAS. */
|
|
34
|
+
EVENT_TYPE_IN_USE = "EVENT_TYPE_IN_USE",
|
|
35
|
+
PACKAGE_NOT_FOUND = "PACKAGE_NOT_FOUND",
|
|
36
|
+
/** 503: rewards-business no respondió al consultar un paquete. */
|
|
37
|
+
PACKAGE_LOOKUP_UNAVAILABLE = "PACKAGE_LOOKUP_UNAVAILABLE",
|
|
38
|
+
/** 400: la evaluación no tiene disparador MANUAL. */
|
|
39
|
+
MANUAL_TRIGGER_MISSING = "MANUAL_TRIGGER_MISSING",
|
|
40
|
+
/** 400: la corrida manual por población llega con la fase 4 (cron masivo). */
|
|
41
|
+
POPULATION_RUN_NOT_SUPPORTED = "POPULATION_RUN_NOT_SUPPORTED",
|
|
42
|
+
/** 409: la corrida no está esperando aprobación. */
|
|
43
|
+
RUN_NOT_AWAITING_APPROVAL = "RUN_NOT_AWAITING_APPROVAL",
|
|
44
|
+
/** 409: la corrida tiene más de un registro de reserva (aprobación masiva = fase 4). */
|
|
45
|
+
APPROVAL_RUN_TOO_LARGE = "APPROVAL_RUN_TOO_LARGE",
|
|
46
|
+
RESULT_NOT_FOUND = "RESULT_NOT_FOUND",
|
|
47
|
+
/** 409: solo se reintenta un sujeto en ERROR o REQUEST_FAILED de una corrida LIVE cerrada. */
|
|
48
|
+
RESULT_NOT_RETRYABLE = "RESULT_NOT_RETRYABLE",
|
|
49
|
+
/** 400: el rango pedido excede el tope de filas de la exportación. */
|
|
50
|
+
EXPORT_TOO_LARGE = "EXPORT_TOO_LARGE",
|
|
51
|
+
/** 503: la tabla de métricas no responde o no existe aún. */
|
|
52
|
+
METRICS_UNAVAILABLE = "METRICS_UNAVAILABLE"
|
|
8
53
|
}
|
|
@@ -9,4 +9,50 @@ var RewardsEligibilityErrorCodeEnum;
|
|
|
9
9
|
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_NOT_FOUND"] = "EVENT_TYPE_NOT_FOUND";
|
|
10
10
|
/** 404: GET /runs/{id} sin corrida. */
|
|
11
11
|
RewardsEligibilityErrorCodeEnum["RUN_NOT_FOUND"] = "RUN_NOT_FOUND";
|
|
12
|
+
// ── Backoffice (fase 3) ──
|
|
13
|
+
/** 400: el cuerpo no cumple el DTO (solo nombres de propiedad, nunca valores). */
|
|
14
|
+
RewardsEligibilityErrorCodeEnum["VALIDATION_ERROR"] = "VALIDATION_ERROR";
|
|
15
|
+
/** 400: `limit` fuera de rango o `cursor` que no devolvió esta API. */
|
|
16
|
+
RewardsEligibilityErrorCodeEnum["INVALID_PAGE"] = "INVALID_PAGE";
|
|
17
|
+
/** 400: un filtro de query (`outcome`, `status`, `dimension`, fechas…) no es válido. */
|
|
18
|
+
RewardsEligibilityErrorCodeEnum["INVALID_FILTER"] = "INVALID_FILTER";
|
|
19
|
+
/** 503: el índice de listado aún no existe en la tabla (pendiente de infraestructura). */
|
|
20
|
+
RewardsEligibilityErrorCodeEnum["LIST_INDEX_NOT_AVAILABLE"] = "LIST_INDEX_NOT_AVAILABLE";
|
|
21
|
+
/** 409: otra persona editó la misma fila. */
|
|
22
|
+
RewardsEligibilityErrorCodeEnum["VERSION_CONFLICT"] = "VERSION_CONFLICT";
|
|
23
|
+
/** 400: el id de la ruta no coincide con el del cuerpo. */
|
|
24
|
+
RewardsEligibilityErrorCodeEnum["REQUEST_ID_MISMATCH"] = "REQUEST_ID_MISMATCH";
|
|
25
|
+
/** 409: la transición de estado no está permitida. */
|
|
26
|
+
RewardsEligibilityErrorCodeEnum["INVALID_STATUS_TRANSITION"] = "INVALID_STATUS_TRANSITION";
|
|
27
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_NOT_FOUND"] = "CAMPAIGN_NOT_FOUND";
|
|
28
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_ALREADY_EXISTS"] = "CAMPAIGN_ALREADY_EXISTS";
|
|
29
|
+
RewardsEligibilityErrorCodeEnum["CAMPAIGN_INVALID"] = "CAMPAIGN_INVALID";
|
|
30
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_NOT_FOUND"] = "EVALUATION_NOT_FOUND";
|
|
31
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_ALREADY_EXISTS"] = "EVALUATION_ALREADY_EXISTS";
|
|
32
|
+
/** 400: la evaluación no pasa las validaciones del spec 5.1 (lista TODOS los problemas). */
|
|
33
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_INVALID"] = "EVALUATION_INVALID";
|
|
34
|
+
/** 409: la evaluación o su campaña no están en condiciones de correr (estado o vigencia). */
|
|
35
|
+
RewardsEligibilityErrorCodeEnum["EVALUATION_NOT_RUNNABLE"] = "EVALUATION_NOT_RUNNABLE";
|
|
36
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_ALREADY_EXISTS"] = "EVENT_TYPE_ALREADY_EXISTS";
|
|
37
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_INVALID"] = "EVENT_TYPE_INVALID";
|
|
38
|
+
/** 409: el tipo de evento lo escuchan evaluaciones ACTIVAS. */
|
|
39
|
+
RewardsEligibilityErrorCodeEnum["EVENT_TYPE_IN_USE"] = "EVENT_TYPE_IN_USE";
|
|
40
|
+
RewardsEligibilityErrorCodeEnum["PACKAGE_NOT_FOUND"] = "PACKAGE_NOT_FOUND";
|
|
41
|
+
/** 503: rewards-business no respondió al consultar un paquete. */
|
|
42
|
+
RewardsEligibilityErrorCodeEnum["PACKAGE_LOOKUP_UNAVAILABLE"] = "PACKAGE_LOOKUP_UNAVAILABLE";
|
|
43
|
+
/** 400: la evaluación no tiene disparador MANUAL. */
|
|
44
|
+
RewardsEligibilityErrorCodeEnum["MANUAL_TRIGGER_MISSING"] = "MANUAL_TRIGGER_MISSING";
|
|
45
|
+
/** 400: la corrida manual por población llega con la fase 4 (cron masivo). */
|
|
46
|
+
RewardsEligibilityErrorCodeEnum["POPULATION_RUN_NOT_SUPPORTED"] = "POPULATION_RUN_NOT_SUPPORTED";
|
|
47
|
+
/** 409: la corrida no está esperando aprobación. */
|
|
48
|
+
RewardsEligibilityErrorCodeEnum["RUN_NOT_AWAITING_APPROVAL"] = "RUN_NOT_AWAITING_APPROVAL";
|
|
49
|
+
/** 409: la corrida tiene más de un registro de reserva (aprobación masiva = fase 4). */
|
|
50
|
+
RewardsEligibilityErrorCodeEnum["APPROVAL_RUN_TOO_LARGE"] = "APPROVAL_RUN_TOO_LARGE";
|
|
51
|
+
RewardsEligibilityErrorCodeEnum["RESULT_NOT_FOUND"] = "RESULT_NOT_FOUND";
|
|
52
|
+
/** 409: solo se reintenta un sujeto en ERROR o REQUEST_FAILED de una corrida LIVE cerrada. */
|
|
53
|
+
RewardsEligibilityErrorCodeEnum["RESULT_NOT_RETRYABLE"] = "RESULT_NOT_RETRYABLE";
|
|
54
|
+
/** 400: el rango pedido excede el tope de filas de la exportación. */
|
|
55
|
+
RewardsEligibilityErrorCodeEnum["EXPORT_TOO_LARGE"] = "EXPORT_TOO_LARGE";
|
|
56
|
+
/** 503: la tabla de métricas no responde o no existe aún. */
|
|
57
|
+
RewardsEligibilityErrorCodeEnum["METRICS_UNAVAILABLE"] = "METRICS_UNAVAILABLE";
|
|
12
58
|
})(RewardsEligibilityErrorCodeEnum || (exports.RewardsEligibilityErrorCodeEnum = RewardsEligibilityErrorCodeEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Tipo de valor de un campo del catálogo de reglas (`GET /rule-catalog`). */
|
|
2
|
+
export declare enum RuleValueTypeEnum {
|
|
3
|
+
NUMBER = "NUMBER",
|
|
4
|
+
STRING = "STRING",
|
|
5
|
+
BOOLEAN = "BOOLEAN",
|
|
6
|
+
DATE = "DATE",
|
|
7
|
+
/** Lista de textos (ej. `directory.scope`). */
|
|
8
|
+
STRING_LIST = "STRING_LIST"
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleValueTypeEnum = void 0;
|
|
4
|
+
/** Tipo de valor de un campo del catálogo de reglas (`GET /rule-catalog`). */
|
|
5
|
+
var RuleValueTypeEnum;
|
|
6
|
+
(function (RuleValueTypeEnum) {
|
|
7
|
+
RuleValueTypeEnum["NUMBER"] = "NUMBER";
|
|
8
|
+
RuleValueTypeEnum["STRING"] = "STRING";
|
|
9
|
+
RuleValueTypeEnum["BOOLEAN"] = "BOOLEAN";
|
|
10
|
+
RuleValueTypeEnum["DATE"] = "DATE";
|
|
11
|
+
/** Lista de textos (ej. `directory.scope`). */
|
|
12
|
+
RuleValueTypeEnum["STRING_LIST"] = "STRING_LIST";
|
|
13
|
+
})(RuleValueTypeEnum || (exports.RuleValueTypeEnum = RuleValueTypeEnum = {}));
|
|
@@ -29,3 +29,37 @@ export * from './dtos/CampaignAlerts';
|
|
|
29
29
|
export * from './dtos/PopulationRef';
|
|
30
30
|
export * from './dtos/EvaluationReward';
|
|
31
31
|
export * from './dtos/EvaluationTrigger';
|
|
32
|
+
export * from './enums/MetricsDimensionEnum';
|
|
33
|
+
export * from './enums/RuleValueTypeEnum';
|
|
34
|
+
export * from './constants/BackofficeLimits';
|
|
35
|
+
export * from './dtos/backoffice/CampaignRequest';
|
|
36
|
+
export * from './dtos/backoffice/CampaignStatusRequest';
|
|
37
|
+
export * from './dtos/backoffice/CampaignResponse';
|
|
38
|
+
export * from './dtos/backoffice/CampaignListResponse';
|
|
39
|
+
export * from './dtos/backoffice/QuotaUsageResponse';
|
|
40
|
+
export * from './dtos/backoffice/CampaignSummaryResponse';
|
|
41
|
+
export * from './dtos/backoffice/EventTypeRequest';
|
|
42
|
+
export * from './dtos/backoffice/EventTypeResponse';
|
|
43
|
+
export * from './dtos/backoffice/EventTypeListResponse';
|
|
44
|
+
export * from './dtos/backoffice/EvaluationRequest';
|
|
45
|
+
export * from './dtos/backoffice/EvaluationStatusRequest';
|
|
46
|
+
export * from './dtos/backoffice/EvaluationResponse';
|
|
47
|
+
export * from './dtos/backoffice/EvaluationListResponse';
|
|
48
|
+
export * from './dtos/backoffice/ResultTraceResponse';
|
|
49
|
+
export * from './dtos/backoffice/SimulateRequest';
|
|
50
|
+
export * from './dtos/backoffice/SimulateResponse';
|
|
51
|
+
export * from './dtos/backoffice/RuleCatalogResponse';
|
|
52
|
+
export * from './dtos/backoffice/PopulationSourceResponse';
|
|
53
|
+
export * from './dtos/backoffice/InputTypeResponse';
|
|
54
|
+
export * from './dtos/backoffice/CreateRunRequest';
|
|
55
|
+
export * from './dtos/backoffice/PopulationRunRequest';
|
|
56
|
+
export * from './dtos/backoffice/ApproveRunRequest';
|
|
57
|
+
export * from './dtos/backoffice/QuotaImpactResponse';
|
|
58
|
+
export * from './dtos/backoffice/RunResponse';
|
|
59
|
+
export * from './dtos/backoffice/RunListResponse';
|
|
60
|
+
export * from './dtos/backoffice/RunResultResponse';
|
|
61
|
+
export * from './dtos/backoffice/RunResultListResponse';
|
|
62
|
+
export * from './dtos/backoffice/CreateRunResponse';
|
|
63
|
+
export * from './dtos/backoffice/MetricsPointResponse';
|
|
64
|
+
export * from './dtos/backoffice/FailedConditionStatResponse';
|
|
65
|
+
export * from './dtos/backoffice/MetricsQuery';
|
|
@@ -50,3 +50,38 @@ __exportStar(require("./dtos/CampaignAlerts"), exports);
|
|
|
50
50
|
__exportStar(require("./dtos/PopulationRef"), exports);
|
|
51
51
|
__exportStar(require("./dtos/EvaluationReward"), exports);
|
|
52
52
|
__exportStar(require("./dtos/EvaluationTrigger"), exports);
|
|
53
|
+
//Backoffice (fase 3): enums, constantes y DTOs
|
|
54
|
+
__exportStar(require("./enums/MetricsDimensionEnum"), exports);
|
|
55
|
+
__exportStar(require("./enums/RuleValueTypeEnum"), exports);
|
|
56
|
+
__exportStar(require("./constants/BackofficeLimits"), exports);
|
|
57
|
+
__exportStar(require("./dtos/backoffice/CampaignRequest"), exports);
|
|
58
|
+
__exportStar(require("./dtos/backoffice/CampaignStatusRequest"), exports);
|
|
59
|
+
__exportStar(require("./dtos/backoffice/CampaignResponse"), exports);
|
|
60
|
+
__exportStar(require("./dtos/backoffice/CampaignListResponse"), exports);
|
|
61
|
+
__exportStar(require("./dtos/backoffice/QuotaUsageResponse"), exports);
|
|
62
|
+
__exportStar(require("./dtos/backoffice/CampaignSummaryResponse"), exports);
|
|
63
|
+
__exportStar(require("./dtos/backoffice/EventTypeRequest"), exports);
|
|
64
|
+
__exportStar(require("./dtos/backoffice/EventTypeResponse"), exports);
|
|
65
|
+
__exportStar(require("./dtos/backoffice/EventTypeListResponse"), exports);
|
|
66
|
+
__exportStar(require("./dtos/backoffice/EvaluationRequest"), exports);
|
|
67
|
+
__exportStar(require("./dtos/backoffice/EvaluationStatusRequest"), exports);
|
|
68
|
+
__exportStar(require("./dtos/backoffice/EvaluationResponse"), exports);
|
|
69
|
+
__exportStar(require("./dtos/backoffice/EvaluationListResponse"), exports);
|
|
70
|
+
__exportStar(require("./dtos/backoffice/ResultTraceResponse"), exports);
|
|
71
|
+
__exportStar(require("./dtos/backoffice/SimulateRequest"), exports);
|
|
72
|
+
__exportStar(require("./dtos/backoffice/SimulateResponse"), exports);
|
|
73
|
+
__exportStar(require("./dtos/backoffice/RuleCatalogResponse"), exports);
|
|
74
|
+
__exportStar(require("./dtos/backoffice/PopulationSourceResponse"), exports);
|
|
75
|
+
__exportStar(require("./dtos/backoffice/InputTypeResponse"), exports);
|
|
76
|
+
__exportStar(require("./dtos/backoffice/CreateRunRequest"), exports);
|
|
77
|
+
__exportStar(require("./dtos/backoffice/PopulationRunRequest"), exports);
|
|
78
|
+
__exportStar(require("./dtos/backoffice/ApproveRunRequest"), exports);
|
|
79
|
+
__exportStar(require("./dtos/backoffice/QuotaImpactResponse"), exports);
|
|
80
|
+
__exportStar(require("./dtos/backoffice/RunResponse"), exports);
|
|
81
|
+
__exportStar(require("./dtos/backoffice/RunListResponse"), exports);
|
|
82
|
+
__exportStar(require("./dtos/backoffice/RunResultResponse"), exports);
|
|
83
|
+
__exportStar(require("./dtos/backoffice/RunResultListResponse"), exports);
|
|
84
|
+
__exportStar(require("./dtos/backoffice/CreateRunResponse"), exports);
|
|
85
|
+
__exportStar(require("./dtos/backoffice/MetricsPointResponse"), exports);
|
|
86
|
+
__exportStar(require("./dtos/backoffice/FailedConditionStatResponse"), exports);
|
|
87
|
+
__exportStar(require("./dtos/backoffice/MetricsQuery"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Id de campaña, evaluación (minúsculas, dígitos y guion; 2 a 64; sin `#` ni `:` porque entran en llaves compuestas y en la idempotencyKey). */
|
|
2
|
+
export const ELIGIBILITY_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
3
|
+
/** `eventKey` de un tipo de evento: MAYÚSCULAS con guion bajo (ej. `PHONE_SALES_CODE_REDEEMED`). */
|
|
4
|
+
export const EVENT_KEY_PATTERN = /^[A-Z][A-Z0-9_]{2,63}$/;
|
|
5
|
+
/** Fecha de vigencia de una campaña (UTC, inclusiva). */
|
|
6
|
+
export const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
/** Id de solicitud que genera el backoffice al abrir el formulario de una corrida manual (llave de idempotencia). */
|
|
8
|
+
export const REQUEST_ID_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
|
|
9
|
+
/** Cupos por campaña que caben junto a las reservas de una transacción (100 − 90 − registro del lote). */
|
|
10
|
+
export const MAX_QUOTAS_PER_CAMPAIGN = 9;
|
|
11
|
+
/** Tope de `limit` de los listados paginados. */
|
|
12
|
+
export const LIST_PAGE_MAX = 100;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsNumber, Max, Min } from 'class-validator';
|
|
3
|
+
|
|
1
4
|
/** Umbrales de consumo (0 a 1) que avisan a los operadores (spec B 5.6). */
|
|
2
5
|
export class CampaignAlerts {
|
|
6
|
+
@Expose()
|
|
7
|
+
@IsArray()
|
|
8
|
+
@ArrayMaxSize(5)
|
|
9
|
+
@IsNumber({}, { each: true })
|
|
10
|
+
@Min(0.01, { each: true })
|
|
11
|
+
@Max(1, { each: true })
|
|
3
12
|
thresholds: number[];
|
|
4
13
|
}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsInt, IsString, Matches, Min } from 'class-validator';
|
|
1
3
|
import { QuotaPeriodEnum } from '../enums/QuotaPeriodEnum';
|
|
2
4
|
|
|
3
5
|
/** Un cupo de campania: cantidad maxima de premios (no dinero) en un periodo (spec B 5.6). */
|
|
4
6
|
export class CampaignQuota {
|
|
5
|
-
/** Unico dentro de la campania (ej. `primeros-500`). Entra en la llave del consumo (`{id}#{periodo}`)
|
|
7
|
+
/** Unico dentro de la campania (ej. `primeros-500`). Entra en la llave del consumo (`{id}#{periodo}`): sin `#`. */
|
|
8
|
+
@Expose()
|
|
9
|
+
@IsString()
|
|
10
|
+
@Matches(/^[a-z0-9][a-z0-9-]{0,62}$/)
|
|
6
11
|
id: string;
|
|
12
|
+
|
|
13
|
+
@Expose()
|
|
14
|
+
@IsInt()
|
|
15
|
+
@Min(1)
|
|
7
16
|
limit: number;
|
|
17
|
+
|
|
18
|
+
@Expose()
|
|
19
|
+
@IsEnum(QuotaPeriodEnum)
|
|
8
20
|
period: QuotaPeriodEnum;
|
|
9
21
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsOptional, IsString, Matches } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/** `POST /runs/{id}/approve`: aprueba todo salvo los sujetos excluidos (`subjectKey`). */
|
|
5
|
+
export class ApproveRunRequest {
|
|
6
|
+
@Expose()
|
|
7
|
+
@IsOptional()
|
|
8
|
+
@IsArray()
|
|
9
|
+
@ArrayMaxSize(1000)
|
|
10
|
+
@IsString({ each: true })
|
|
11
|
+
@Matches(/^[A-Za-z0-9_-]{8,128}$/, { each: true })
|
|
12
|
+
excludeSubjectKeys?: string[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsDefined, IsEnum, IsNotEmpty, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
|
|
3
|
+
import { DATE_PATTERN, ELIGIBILITY_ID_PATTERN, MAX_QUOTAS_PER_CAMPAIGN } from '../../constants/BackofficeLimits';
|
|
4
|
+
import { QuotaExhaustedActionEnum } from '../../enums/QuotaExhaustedActionEnum';
|
|
5
|
+
import { CampaignAlerts } from '../CampaignAlerts';
|
|
6
|
+
import { CampaignQuota } from '../CampaignQuota';
|
|
7
|
+
|
|
8
|
+
/** Crear (POST) o reemplazar (PUT) una campaña. `status`, `pausedReason` y las fechas de auditoría las pone el servidor (el estado cambia con `POST /campaigns/{id}/status`). */
|
|
9
|
+
export class CampaignRequest {
|
|
10
|
+
@Expose()
|
|
11
|
+
@IsString()
|
|
12
|
+
@Matches(ELIGIBILITY_ID_PATTERN)
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
@Expose()
|
|
16
|
+
@IsString()
|
|
17
|
+
@IsNotEmpty()
|
|
18
|
+
@MaxLength(120)
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
/** Qué se quiere lograr (texto libre). */
|
|
22
|
+
@Expose()
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
@MaxLength(500)
|
|
26
|
+
objective: string;
|
|
27
|
+
|
|
28
|
+
/** `AAAA-MM-DD` (UTC, inclusiva). */
|
|
29
|
+
@Expose()
|
|
30
|
+
@Matches(DATE_PATTERN)
|
|
31
|
+
startsAt: string;
|
|
32
|
+
|
|
33
|
+
@Expose()
|
|
34
|
+
@Matches(DATE_PATTERN)
|
|
35
|
+
endsAt: string;
|
|
36
|
+
|
|
37
|
+
@Expose()
|
|
38
|
+
@IsArray()
|
|
39
|
+
@ArrayMaxSize(MAX_QUOTAS_PER_CAMPAIGN)
|
|
40
|
+
@ValidateNested({ each: true })
|
|
41
|
+
@Type(() => CampaignQuota)
|
|
42
|
+
quotas: CampaignQuota[];
|
|
43
|
+
|
|
44
|
+
@Expose()
|
|
45
|
+
@IsEnum(QuotaExhaustedActionEnum)
|
|
46
|
+
onExhausted: QuotaExhaustedActionEnum;
|
|
47
|
+
|
|
48
|
+
@Expose()
|
|
49
|
+
@IsDefined()
|
|
50
|
+
@ValidateNested()
|
|
51
|
+
@Type(() => CampaignAlerts)
|
|
52
|
+
alerts: CampaignAlerts;
|
|
53
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CampaignPausedReasonEnum } from '../../enums/CampaignPausedReasonEnum';
|
|
2
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
3
|
+
import { QuotaExhaustedActionEnum } from '../../enums/QuotaExhaustedActionEnum';
|
|
4
|
+
import { CampaignAlerts } from '../CampaignAlerts';
|
|
5
|
+
import { CampaignQuota } from '../CampaignQuota';
|
|
6
|
+
|
|
7
|
+
/** Una campaña (spec B 5.6). */
|
|
8
|
+
export class CampaignResponse {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
status: CampaignStatusEnum;
|
|
13
|
+
/** Solo si `status` es `PAUSED`. */
|
|
14
|
+
pausedReason?: CampaignPausedReasonEnum;
|
|
15
|
+
startsAt: string;
|
|
16
|
+
endsAt: string;
|
|
17
|
+
quotas: CampaignQuota[];
|
|
18
|
+
onExhausted: QuotaExhaustedActionEnum;
|
|
19
|
+
alerts: CampaignAlerts;
|
|
20
|
+
/** Epoch en milisegundos. */
|
|
21
|
+
createdAt: number;
|
|
22
|
+
updatedAt: number;
|
|
23
|
+
updatedBy: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum } from 'class-validator';
|
|
3
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
4
|
+
|
|
5
|
+
/** Cuerpo de `POST /campaigns/{id}/status`: activar, pausar, terminar o archivar. */
|
|
6
|
+
export class CampaignStatusRequest {
|
|
7
|
+
@Expose()
|
|
8
|
+
@IsEnum(CampaignStatusEnum)
|
|
9
|
+
status: CampaignStatusEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CampaignPausedReasonEnum } from '../../enums/CampaignPausedReasonEnum';
|
|
2
|
+
import { CampaignStatusEnum } from '../../enums/CampaignStatusEnum';
|
|
3
|
+
|
|
4
|
+
/** Fila de la tabla ejecutiva `GET /campaigns/summary` (spec 10.1). */
|
|
5
|
+
export class CampaignSummaryResponse {
|
|
6
|
+
campaignId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
status: CampaignStatusEnum;
|
|
9
|
+
pausedReason?: CampaignPausedReasonEnum;
|
|
10
|
+
startsAt: string;
|
|
11
|
+
endsAt: string;
|
|
12
|
+
evaluated: number;
|
|
13
|
+
matched: number;
|
|
14
|
+
requested: number;
|
|
15
|
+
quotaExhausted: number;
|
|
16
|
+
/** Cupo más restrictivo, de 0 a 1 (0 si la campaña no tiene cupos). */
|
|
17
|
+
quotaUsed: number;
|
|
18
|
+
/** Ritmo diario de pedidos de los últimos 7 días (para proyectar el agotamiento). */
|
|
19
|
+
dailyRate: number;
|
|
20
|
+
/** `AAAA-MM-DD` estimada en que se agota el cupo más restrictivo al ritmo actual; ausente si no aplica. */
|
|
21
|
+
projectedExhaustionDate?: string;
|
|
22
|
+
/** Valor entregado: lo calcula rewards por `campaignId`; este lambda no lo informa. */
|
|
23
|
+
value?: { amount: number; currency: string }[];
|
|
24
|
+
/** Entregados de verdad según rewards; este lambda no lo informa. */
|
|
25
|
+
granted?: number;
|
|
26
|
+
}
|