add core api
This commit is contained in:
@@ -17,53 +17,57 @@ export const packageRequestSchema = z.object({
|
||||
|
||||
export const packageDetailRequestSchema = z.object({
|
||||
departure_date: dateSchema,
|
||||
tour_flight_slugs: z
|
||||
tour_flight_ids: z
|
||||
.array(
|
||||
z
|
||||
.string("Must be string.")
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(420, "Max 420 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
"Must be array.",
|
||||
)
|
||||
.nonempty("Must not empty.")
|
||||
.nullable(),
|
||||
outbound_flight_ids: z
|
||||
.array(
|
||||
z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(30, "Max 30 characters."),
|
||||
"Must be array.",
|
||||
)
|
||||
.nonempty("Must not empty."),
|
||||
outbound_flight_slugs: z
|
||||
inbound_flight_ids: z
|
||||
.array(
|
||||
z
|
||||
.string("Must be string.")
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(420, "Max 420 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
"Must be array.",
|
||||
)
|
||||
.nonempty("Must not empty."),
|
||||
inbound_flight_slugs: z
|
||||
tour_hotels: z
|
||||
.array(
|
||||
z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(420, "Max 420 characters."),
|
||||
z.object(
|
||||
{
|
||||
hotel_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(30, "Max 30 characters."),
|
||||
check_in: timeSchema,
|
||||
check_out: timeSchema,
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
"Must be array.",
|
||||
)
|
||||
.nonempty("Must not empty."),
|
||||
tour_hotels: z.array(
|
||||
z.object(
|
||||
{
|
||||
hotel_slug: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
check_in: timeSchema,
|
||||
check_out: timeSchema,
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
"Must be array.",
|
||||
),
|
||||
.nonempty("Must not empty.")
|
||||
.nullable(),
|
||||
makkah_hotel: z.object(
|
||||
{
|
||||
hotel_slug: z
|
||||
.string("Must be string.")
|
||||
hotel_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
check_in: timeSchema,
|
||||
check_out: timeSchema,
|
||||
},
|
||||
@@ -71,19 +75,19 @@ export const packageDetailRequestSchema = z.object({
|
||||
),
|
||||
madinah_hotel: z.object(
|
||||
{
|
||||
hotel_slug: z
|
||||
.string("Must be string.")
|
||||
hotel_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
check_in: timeSchema,
|
||||
check_out: timeSchema,
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
transportation_slug: z
|
||||
.string("Must be string.")
|
||||
transportation_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
quad_price: z
|
||||
.number("Must be number.")
|
||||
.int("Must be integer.")
|
||||
@@ -101,22 +105,97 @@ export const packageDetailRequestSchema = z.object({
|
||||
.int("Must be integer.")
|
||||
.positive("Must be positive.")
|
||||
.nullable(),
|
||||
itineraries: z.array(
|
||||
z.object(
|
||||
{
|
||||
location: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(100, "Max 100 characters."),
|
||||
images: z.array(
|
||||
z.base64("Must be base64 string.").nonempty("Must not empty."),
|
||||
"Must be array.",
|
||||
),
|
||||
days: z.array(
|
||||
z.object(
|
||||
{
|
||||
title: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(100, "Max 100 characters."),
|
||||
description: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(1000, "Max 1000 characters."),
|
||||
widgets: z.array(
|
||||
z.discriminatedUnion("type", [
|
||||
z.object(
|
||||
{
|
||||
type: z.literal("transport"),
|
||||
transportation: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(100, "Max 100 characters."),
|
||||
from: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(100, "Max 100 characters."),
|
||||
to: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(100, "Max 100 characters."),
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
z.object(
|
||||
{
|
||||
type: z.literal("hotel"),
|
||||
hotel_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(30, "Max 30 characters."),
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
z.object(
|
||||
{
|
||||
type: z.literal("information"),
|
||||
description: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(1000, "Max 1000 characters."),
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
]),
|
||||
"Must be array.",
|
||||
),
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
"Must be array.",
|
||||
),
|
||||
},
|
||||
"Must be object.",
|
||||
),
|
||||
"Must be array.",
|
||||
),
|
||||
});
|
||||
|
||||
export const packageQuerySchema = z.object({
|
||||
detail_slug: z
|
||||
.string("Must be string.")
|
||||
export const packageParamsSchema = z.object({
|
||||
id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
slug: z
|
||||
.string("Must be string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
});
|
||||
|
||||
export const packageDetailQuerySchema = z.object({
|
||||
slug: z
|
||||
.string("Must be string.")
|
||||
export const packageDetailParamsSchema = z.object({
|
||||
package_id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(200, "Max 200 characters."),
|
||||
.max(30, "Max 30 characters."),
|
||||
id: z
|
||||
.ulid("Must be ulid string.")
|
||||
.nonempty("Must not empty.")
|
||||
.max(30, "Max 30 characters."),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user