feat(SW-1710): add access checks to my stay page for viewing booking
This commit is contained in:
@@ -112,7 +112,7 @@ export const cancelBookingInput = z.object({
|
||||
})
|
||||
|
||||
export const createRefIdInput = z.object({
|
||||
bookingNumber: z
|
||||
confirmationNumber: z
|
||||
.string()
|
||||
.trim()
|
||||
.regex(/^\s*[0-9]+(-[0-9])?\s*$/)
|
||||
|
||||
@@ -80,6 +80,8 @@ const guestSchema = z.object({
|
||||
countryCode: z.string().nullable().default(""),
|
||||
})
|
||||
|
||||
export type Guest = z.output<typeof guestSchema>
|
||||
|
||||
export const packageSchema = z
|
||||
.object({
|
||||
type: z.string().nullable(),
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@/server/trpc"
|
||||
|
||||
import { getHotel } from "../hotels/query"
|
||||
import encryptValue from "../utils/encryptValue"
|
||||
import { encrypt } from "../utils/encryption"
|
||||
import {
|
||||
bookingConfirmationInput,
|
||||
createRefIdInput,
|
||||
@@ -241,8 +241,8 @@ export const bookingQueryRouter = router({
|
||||
createRefId: serviceProcedure
|
||||
.input(createRefIdInput)
|
||||
.mutation(async function ({ input }) {
|
||||
const { bookingNumber, lastName } = input
|
||||
const encryptedRefId = encryptValue(`${bookingNumber},${lastName}`)
|
||||
const { confirmationNumber, lastName } = input
|
||||
const encryptedRefId = encrypt(`${confirmationNumber},${lastName}`)
|
||||
|
||||
if (!encryptedRefId) {
|
||||
throw serverErrorByStatus(422, "Was not able to encrypt ref id")
|
||||
|
||||
Reference in New Issue
Block a user