fix: cache hotel response
This commit is contained in:
12
utils/zod/numberValidator.ts
Normal file
12
utils/zod/numberValidator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const nullableNumberValidator = z
|
||||
.number()
|
||||
.nullish()
|
||||
.transform((num) => (typeof num === "number" ? num : 0))
|
||||
|
||||
export const nullableIntValidator = z
|
||||
.number()
|
||||
.int()
|
||||
.nullish()
|
||||
.transform((num) => (typeof num === "number" ? num : 0))
|
||||
12
utils/zod/stringValidator.ts
Normal file
12
utils/zod/stringValidator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const nullableStringValidator = z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((str) => (str ? str : ""))
|
||||
|
||||
export const nullableStringUrlValidator = z
|
||||
.string()
|
||||
.url()
|
||||
.nullish()
|
||||
.transform((str) => (str ? str : ""))
|
||||
Reference in New Issue
Block a user