feat: loosen up the zod validations and return null instead of throwing
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { UserQueryRouter } from "../user"
|
||||
|
||||
export type TransactionResponse = Awaited<
|
||||
ReturnType<UserQueryRouter["transaction"]["friendTransactions"]>
|
||||
>
|
||||
export type TransactionsObject = NonNullable<TransactionResponse>
|
||||
export type Transactions = NonNullable<TransactionResponse>["data"]
|
||||
export type Transaction = NonNullable<TransactionResponse>["data"][number]
|
||||
|
||||
export type ClientEarnAndBurnProps = {
|
||||
initialData: TransactionsObject
|
||||
lang: Lang
|
||||
}
|
||||
|
||||
export type EarnAndBurnProps = {
|
||||
lang: Lang
|
||||
}
|
||||
|
||||
type Transaction = {
|
||||
checkinDate: string
|
||||
checkoutDate: string
|
||||
awardPoints: number
|
||||
hotelName?: string
|
||||
city?: string
|
||||
nights: number
|
||||
confirmationNumber: string
|
||||
export interface TableProps {
|
||||
lang: Lang
|
||||
transactions: Transactions
|
||||
}
|
||||
|
||||
export type Page = {
|
||||
data: Transaction[]
|
||||
nextCursor?: number
|
||||
}
|
||||
|
||||
export type RowProps = {
|
||||
export interface RowProps {
|
||||
lang: Lang
|
||||
transaction: Transaction
|
||||
}
|
||||
|
||||
15
types/components/myPages/stays/previous.ts
Normal file
15
types/components/myPages/stays/previous.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { UserQueryRouter } from "../user"
|
||||
|
||||
export type PreviousStaysResponse = Awaited<
|
||||
ReturnType<UserQueryRouter["stays"]["previous"]>
|
||||
>
|
||||
export type PreviousStaysNonNullResponseObject =
|
||||
NonNullable<PreviousStaysResponse>
|
||||
export type PreviousStays = NonNullable<PreviousStaysResponse>["data"]
|
||||
export type PreviousStay = NonNullable<PreviousStaysResponse>["data"][number]
|
||||
|
||||
export interface PreviousStaysClientProps {
|
||||
lang: Lang
|
||||
initialPreviousStays: PreviousStaysNonNullResponseObject
|
||||
}
|
||||
15
types/components/myPages/stays/upcoming.ts
Normal file
15
types/components/myPages/stays/upcoming.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { UserQueryRouter } from "../user"
|
||||
|
||||
export type UpcomingStaysResponse = Awaited<
|
||||
ReturnType<UserQueryRouter["stays"]["upcoming"]>
|
||||
>
|
||||
export type UpcomingStaysNonNullResponseObject =
|
||||
NonNullable<UpcomingStaysResponse>
|
||||
export type UpcomingStays = NonNullable<UpcomingStaysResponse>["data"]
|
||||
export type UpcomingStay = NonNullable<UpcomingStaysResponse>["data"][number]
|
||||
|
||||
export interface UpcomingStaysClientProps {
|
||||
lang: Lang
|
||||
initialUpcomingStays: UpcomingStaysNonNullResponseObject
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
import { userQueryRouter } from "@/server/routers/user/query"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
|
||||
export type UserQueryRouter = typeof userQueryRouter
|
||||
|
||||
export interface UserProps {
|
||||
user: User
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user