fe8ffbeb9f
Build & Push / Pipeline Tests (push) Failing after 59s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Failing after 48s
Test / API Unit Tests (push) Has been skipped
Test / Homepage Unit Tests (push) Has been skipped
Test / Carplace Unit Tests (push) Has been skipped
Test / Admin Unit Tests (push) Has been skipped
Test / Dashboard Unit Tests (push) Has been skipped
Test / API Integration Tests (push) Has been skipped
58 lines
2.3 KiB
TypeScript
58 lines
2.3 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
export const slugParamSchema = z.object({ slug: z.string() })
|
|
export const bookingParamSchema = z.object({ slug: z.string(), id: z.string() })
|
|
|
|
export const availabilitySchema = z.object({
|
|
vehicleId: z.string().cuid(),
|
|
startDate: z.string().datetime(),
|
|
endDate: z.string().datetime(),
|
|
})
|
|
|
|
export const validateCodeSchema = z.object({ code: z.string().min(1) })
|
|
|
|
export const bookSchema = z.object({
|
|
vehicleId: z.string().cuid(),
|
|
startDate: z.string().datetime(),
|
|
endDate: z.string().datetime(),
|
|
firstName: z.string().min(1),
|
|
lastName: z.string().min(1),
|
|
email: z.string().email(),
|
|
phone: z.string().min(1).max(30),
|
|
pickupLocation: z.string().trim().min(1).max(100),
|
|
returnLocation: z.string().trim().min(1).max(100),
|
|
driverLicense: z.string().min(1).max(50).optional(),
|
|
dateOfBirth: z.string().datetime().optional(),
|
|
licenseExpiry: z.string().datetime().optional(),
|
|
licenseIssuedAt: z.string().datetime().optional(),
|
|
nationality: z.string().min(1).max(100).optional(),
|
|
identityDocumentNumber: z.string().min(1).max(100).optional(),
|
|
fullAddress: z.string().min(1).max(500).optional(),
|
|
licenseCountry: z.string().min(1).max(100).optional(),
|
|
licenseNumber: z.string().min(1).max(50).optional(),
|
|
licenseCategory: z.string().min(1).max(20).optional(),
|
|
internationalLicenseNumber: z.string().trim().max(100).optional(),
|
|
offerId: z.string().cuid().optional(),
|
|
promoCodeUsed: z.string().optional(),
|
|
notes: z.string().optional(),
|
|
source: z.enum(['PUBLIC_SITE', 'CARPLACE']).default('PUBLIC_SITE'),
|
|
selectedInsurancePolicyIds: z.array(z.string()).default([]),
|
|
additionalDrivers: z.array(z.object({
|
|
firstName: z.string().min(1),
|
|
lastName: z.string().min(1),
|
|
email: z.string().email().optional(),
|
|
phone: z.string().optional(),
|
|
driverLicense: z.string().min(1),
|
|
licenseExpiry: z.string().datetime().optional(),
|
|
licenseIssuedAt: z.string().datetime().optional(),
|
|
dateOfBirth: z.string().datetime().optional(),
|
|
nationality: z.string().optional(),
|
|
})).default([]),
|
|
})
|
|
|
|
export const contactSchema = z.object({
|
|
name: z.string().min(1),
|
|
email: z.string().email(),
|
|
message: z.string().min(1),
|
|
})
|