@fiado/type-kit 3.615.0 → 3.616.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/loanOfferings/segmentCohorts.test.ts +11 -2
- package/bin/loanOfferings/dtos/requests/CreateSegmentRequest.d.ts +2 -0
- package/bin/loanOfferings/dtos/requests/CreateSegmentRequest.js +7 -0
- package/bin/loanOfferings/dtos/requests/UpdateSegmentRequest.d.ts +2 -0
- package/bin/loanOfferings/dtos/requests/UpdateSegmentRequest.js +7 -0
- package/bin/loanOfferings/dtos/responses/SegmentResponse.d.ts +2 -0
- package/package.json +1 -1
- package/src/loanOfferings/dtos/requests/CreateSegmentRequest.ts +7 -0
- package/src/loanOfferings/dtos/requests/UpdateSegmentRequest.ts +7 -0
- package/src/loanOfferings/dtos/responses/SegmentResponse.ts +2 -0
|
@@ -207,7 +207,7 @@ describe('ChangeCohortStatusRequest, TestCohortRequest y ListCohortsQuery', () =
|
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
describe('Segmento con cohorts', () => {
|
|
210
|
-
it('el alta acepta cohortIds y
|
|
210
|
+
it('el alta acepta cohortIds y conserva filterIds como alias deprecado', async () => {
|
|
211
211
|
const dto = toDto(CreateSegmentRequest, {
|
|
212
212
|
name: 'VIP',
|
|
213
213
|
colorSlot: SegmentColorSlotEnum.SLATE,
|
|
@@ -216,7 +216,15 @@ describe('Segmento con cohorts', () => {
|
|
|
216
216
|
});
|
|
217
217
|
expect(await validate(dto)).toHaveLength(0);
|
|
218
218
|
expect(dto.cohortIds).toEqual(['COH-LEVEL-GOLD']);
|
|
219
|
-
expect(
|
|
219
|
+
expect(dto.filterIds).toEqual(['levelGold']);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('filterIds deprecado es opcional y exige textos en alta y edición', async () => {
|
|
223
|
+
expect(await errorProperties(CreateSegmentRequest, { name: 'X' })).toEqual([]);
|
|
224
|
+
expect(await errorProperties(CreateSegmentRequest, { name: 'X', filterIds: [1] })).toEqual(['filterIds']);
|
|
225
|
+
expect(toDto(UpdateSegmentRequest, { filterIds: ['levelGold'] }).filterIds).toEqual(['levelGold']);
|
|
226
|
+
expect(await errorProperties(UpdateSegmentRequest, { filterIds: [] })).toEqual([]);
|
|
227
|
+
expect(await errorProperties(UpdateSegmentRequest, { filterIds: 'levelGold' })).toEqual(['filterIds']);
|
|
220
228
|
});
|
|
221
229
|
|
|
222
230
|
it('limita los cohorts a 20 y exige textos', async () => {
|
|
@@ -277,6 +285,7 @@ describe('Responses de cohorts y segmentos', () => {
|
|
|
277
285
|
description: null,
|
|
278
286
|
colorSlot: SegmentColorSlotEnum.SLATE,
|
|
279
287
|
cohortIds: [cohort.cohortId],
|
|
288
|
+
filterIds: [],
|
|
280
289
|
memberIds: [],
|
|
281
290
|
isDefault: false,
|
|
282
291
|
status: SegmentStatusEnum.ACTIVE,
|
|
@@ -15,6 +15,8 @@ export declare class CreateSegmentRequest {
|
|
|
15
15
|
* dentro de cada cohort las condiciones se unen con Y.
|
|
16
16
|
*/
|
|
17
17
|
cohortIds?: string[];
|
|
18
|
+
/** @deprecated Usar `cohortIds`; se conserva para los consumidores que aún no migran. */
|
|
19
|
+
filterIds?: string[];
|
|
18
20
|
/**
|
|
19
21
|
* Clientes agregados a mano por `retailCustomerId`. Ganan siempre, cumplan o no un cohort.
|
|
20
22
|
* Un segmento puede nacer SOLO con esta lista, sin ningún cohort.
|
|
@@ -50,6 +50,13 @@ __decorate([
|
|
|
50
50
|
(0, class_validator_1.ArrayMaxSize)(20),
|
|
51
51
|
__metadata("design:type", Array)
|
|
52
52
|
], CreateSegmentRequest.prototype, "cohortIds", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_transformer_1.Expose)(),
|
|
55
|
+
(0, class_validator_1.IsOptional)(),
|
|
56
|
+
(0, class_validator_1.IsArray)(),
|
|
57
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
58
|
+
__metadata("design:type", Array)
|
|
59
|
+
], CreateSegmentRequest.prototype, "filterIds", void 0);
|
|
53
60
|
__decorate([
|
|
54
61
|
(0, class_transformer_1.Expose)(),
|
|
55
62
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -12,6 +12,8 @@ export declare class UpdateSegmentRequest {
|
|
|
12
12
|
colorSlot?: SegmentColorSlotEnum;
|
|
13
13
|
/** Reemplaza la lista entera; `[]` deja el segmento sin cohorts. */
|
|
14
14
|
cohortIds?: string[];
|
|
15
|
+
/** @deprecated Usar `cohortIds`; se conserva para los consumidores que aún no migran. */
|
|
16
|
+
filterIds?: string[];
|
|
15
17
|
/** Reemplaza la lista entera; `[]` saca a todos los agregados a mano. */
|
|
16
18
|
memberIds?: string[];
|
|
17
19
|
reason?: string;
|
|
@@ -52,6 +52,13 @@ __decorate([
|
|
|
52
52
|
(0, class_validator_1.ArrayMaxSize)(20),
|
|
53
53
|
__metadata("design:type", Array)
|
|
54
54
|
], UpdateSegmentRequest.prototype, "cohortIds", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_transformer_1.Expose)(),
|
|
57
|
+
(0, class_validator_1.IsOptional)(),
|
|
58
|
+
(0, class_validator_1.IsArray)(),
|
|
59
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
60
|
+
__metadata("design:type", Array)
|
|
61
|
+
], UpdateSegmentRequest.prototype, "filterIds", void 0);
|
|
55
62
|
__decorate([
|
|
56
63
|
(0, class_transformer_1.Expose)(),
|
|
57
64
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -13,6 +13,8 @@ export interface SegmentResponse {
|
|
|
13
13
|
colorSlot: SegmentColorSlotEnum;
|
|
14
14
|
/** Cohorts del segmento. Vacío = no alcanza a nadie por regla. */
|
|
15
15
|
cohortIds: string[];
|
|
16
|
+
/** @deprecated Mismo contenido que `cohortIds`; usar `cohortIds`. */
|
|
17
|
+
filterIds?: string[];
|
|
16
18
|
/** `retailCustomerId` agregados a mano. Ganan aunque el cliente no cumpla ningún cohort. */
|
|
17
19
|
memberIds: string[];
|
|
18
20
|
/** El catch-all implícito. No acepta cohorts ni individuos, no se archiva y solo se renombra. */
|
package/package.json
CHANGED
|
@@ -38,6 +38,13 @@ export class CreateSegmentRequest {
|
|
|
38
38
|
@ArrayMaxSize(20)
|
|
39
39
|
cohortIds?: string[];
|
|
40
40
|
|
|
41
|
+
/** @deprecated Usar `cohortIds`; se conserva para los consumidores que aún no migran. */
|
|
42
|
+
@Expose()
|
|
43
|
+
@IsOptional()
|
|
44
|
+
@IsArray()
|
|
45
|
+
@IsString({ each: true })
|
|
46
|
+
filterIds?: string[];
|
|
47
|
+
|
|
41
48
|
/**
|
|
42
49
|
* Clientes agregados a mano por `retailCustomerId`. Ganan siempre, cumplan o no un cohort.
|
|
43
50
|
* Un segmento puede nacer SOLO con esta lista, sin ningún cohort.
|
|
@@ -36,6 +36,13 @@ export class UpdateSegmentRequest {
|
|
|
36
36
|
@ArrayMaxSize(20)
|
|
37
37
|
cohortIds?: string[];
|
|
38
38
|
|
|
39
|
+
/** @deprecated Usar `cohortIds`; se conserva para los consumidores que aún no migran. */
|
|
40
|
+
@Expose()
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsArray()
|
|
43
|
+
@IsString({ each: true })
|
|
44
|
+
filterIds?: string[];
|
|
45
|
+
|
|
39
46
|
/** Reemplaza la lista entera; `[]` saca a todos los agregados a mano. */
|
|
40
47
|
@Expose()
|
|
41
48
|
@IsOptional()
|
|
@@ -14,6 +14,8 @@ export interface SegmentResponse {
|
|
|
14
14
|
colorSlot: SegmentColorSlotEnum;
|
|
15
15
|
/** Cohorts del segmento. Vacío = no alcanza a nadie por regla. */
|
|
16
16
|
cohortIds: string[];
|
|
17
|
+
/** @deprecated Mismo contenido que `cohortIds`; usar `cohortIds`. */
|
|
18
|
+
filterIds?: string[];
|
|
17
19
|
/** `retailCustomerId` agregados a mano. Ganan aunque el cliente no cumpla ningún cohort. */
|
|
18
20
|
memberIds: string[];
|
|
19
21
|
/** El catch-all implícito. No acepta cohorts ni individuos, no se archiva y solo se renombra. */
|