refactor: zod validation and pr comments

This commit is contained in:
Christel Westerberg
2024-04-29 14:00:24 +02:00
parent 9f0b044daa
commit d9f1470eb7
31 changed files with 222 additions and 207 deletions

View File

@@ -1,7 +1,6 @@
import {
Block,
CardGrid,
CardGridCard,
DynamicContent,
RteBlockContent,
} from "@/server/routers/contentstack/loyaltyPage/output"
@@ -18,8 +17,6 @@ export type DynamicComponentProps = {
component: DynamicContent["dynamic_content"]["component"]
}
export type CardProps = { card: CardGridCard }
export type CardGridProps = Pick<CardGrid, "card_grid">
export type Content = { content: RteBlockContent["content"]["content"] }

View File

@@ -1,10 +1,11 @@
import { ContactFields } from "@/server/routers/contentstack/contactConfig/output"
import {
JoinLoyaltyContact,
Sidebar,
} from "@/server/routers/contentstack/loyaltyPage/output"
export type SidebarProps = {
block: Sidebar
blocks: Sidebar[]
}
export type JoinLoyaltyContactProps = {
@@ -14,3 +15,7 @@ export type JoinLoyaltyContactProps = {
export type ContactProps = {
contactBlock: JoinLoyaltyContact["join_loyalty_contact"]["contact"]
}
export type ContactRowProps = {
contact: ContactFields
}

View File

@@ -1,53 +0,0 @@
import { AllRequestResponse } from "./utils/all"
export type ContactConfig = {
email: {
name?: string
address?: string
}
email_loyalty: {
name?: string
address?: string
}
mailing_address: {
zip?: string
street?: string
name?: string
city?: string
country?: string
}
phone: {
number?: string
name?: string
}
phone_loyalty: {
number?: string
name?: string
}
visiting_address: {
zip?: string
country?: string
city?: string
street?: string
}
}
export enum ContactFieldGroupsEnum {
email = "email",
email_loyalty = "email_loyalty",
mailing_address = "mailing_address",
phone = "phone",
phone_loyalty = "phone_loyalty",
visiting_address = "visiting_address",
}
export type ContactFieldGroups = keyof typeof ContactFieldGroupsEnum
export type GetContactConfigData = {
all_contact_config: AllRequestResponse<ContactConfig>
}
export type ContactFields = {
display_text?: string
contact_field: string
}

View File

@@ -1,11 +1,13 @@
export type GetContentTypeUidType = {
all_content_page: {
total: number
}
all_loyalty_page: {
total: number
}
all_current_blocks_page: {
total: number
}
}
import z from "zod"
export const validateContentTypeUid = z.object({
all_content_page: z.object({
total: z.number(),
}),
all_loyalty_page: z.object({
total: z.number(),
}),
all_current_blocks_page: z.object({
total: z.number(),
}),
})