feat(SW-353): dynamic rewards

This commit is contained in:
Christel Westerberg
2024-09-25 15:59:16 +02:00
parent 6a85cfd19c
commit 56cd02f90b
78 changed files with 1568 additions and 4587 deletions

View File

@@ -0,0 +1,24 @@
import { z } from "zod"
import { MembershipLevelEnum } from "@/constants/membershipLevels"
export const validateLoyaltyLevelsSchema = z
.object({
all_loyalty_level: z.object({
items: z.array(
z.object({
level_id: z.nativeEnum(MembershipLevelEnum),
name: z.string(),
user_facing_tag: z.string().optional(),
description: z.string().optional(),
required_nights: z.number().optional().nullable(),
required_points: z.number(),
})
),
}),
})
.transform((data) => data.all_loyalty_level.items)
export type LoyaltyLevelsResponse = z.input<typeof validateLoyaltyLevelsSchema>
export type LoyaltyLevel = z.output<typeof validateLoyaltyLevelsSchema>[0]