feat: SW-1583 Implemented Reward nights on city search
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { productTypePriceSchema } from "../productTypePrice"
|
||||
import {
|
||||
productTypePriceSchema,
|
||||
productTypePointsSchema,
|
||||
} from "../productTypePrice"
|
||||
|
||||
export const productTypeSchema = z
|
||||
.object({
|
||||
public: productTypePriceSchema.optional(),
|
||||
member: productTypePriceSchema.optional(),
|
||||
redemption: productTypePointsSchema.optional(),
|
||||
redemptionA: productTypePointsSchema.optional(),
|
||||
redemptionB: productTypePointsSchema.optional(),
|
||||
})
|
||||
.optional()
|
||||
|
||||
@@ -10,9 +10,24 @@ export const priceSchema = z.object({
|
||||
regularPricePerStay: z.coerce.number().optional(),
|
||||
})
|
||||
|
||||
export const productTypePriceSchema = z.object({
|
||||
localPrice: priceSchema,
|
||||
export const pointsSchema = z.object({
|
||||
currency: z.nativeEnum(CurrencyEnum).optional(),
|
||||
pricePerNight: z.coerce.number().optional(),
|
||||
pricePerStay: z.coerce.number().optional(),
|
||||
pointsPerNight: z.number(),
|
||||
pointsPerStay: z.number(),
|
||||
})
|
||||
|
||||
const partialPriceSchema = z.object({
|
||||
rateCode: z.string(),
|
||||
rateType: z.string().optional(),
|
||||
requestedPrice: priceSchema.optional(),
|
||||
})
|
||||
|
||||
export const productTypePriceSchema = partialPriceSchema.extend({
|
||||
localPrice: priceSchema,
|
||||
})
|
||||
|
||||
export const productTypePointsSchema = partialPriceSchema.extend({
|
||||
localPrice: pointsSchema,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user