Skip to content

Commit 38ab6cb

Browse files
authored
Fix countries field name in v2 promo model (#3325)
* Fix countries field name in v2 promo model * fix test
1 parent 0747b7b commit 38ab6cb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

handlers/promotions-lambdas/src/handlers/promoSync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const transformPromo = (oldPromo: OldPromo): Promo[] => {
4242
appliesTo: {
4343
productRatePlanIds: oldPromo.appliesTo.productRatePlanIds,
4444
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- the old schema only uses string
45-
countryGroups: oldPromo.appliesTo
46-
.countries as Promo['appliesTo']['countryGroups'],
45+
countries: oldPromo.appliesTo
46+
.countries as Promo['appliesTo']['countries'],
4747
},
4848
startTimestamp: oldPromo.starts.toISOString(),
4949
};

handlers/promotions-lambdas/test/promoSync.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('promoSync handler', () => {
5858
'2c92c0f965f2122101660fb33ed24a45',
5959
'2c92c0f965d280590165f16b1b9946c2',
6060
],
61-
countryGroups: ['GB'],
61+
countries: ['GB'],
6262
},
6363
startTimestamp: '2025-11-17T00:00:00.000Z',
6464
endTimestamp: '2026-11-17T00:00:00.000Z',

modules/promotions/src/v2/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type PromoCampaign = z.infer<typeof promoCampaignSchema>;
2020

2121
export const appliesToSchema = z.object({
2222
productRatePlanIds: z.array(z.string()),
23-
countryGroups: z.array(isoCountrySchema),
23+
countries: z.array(isoCountrySchema),
2424
});
2525

2626
export const discountDetailsSchema = z.object({

0 commit comments

Comments
 (0)