feat: styling zod schema and data migration

This commit is contained in:
pandeymangg
2024-02-28 11:24:27 +05:30
parent ed2253dcfc
commit 1f884a408c
2 changed files with 31 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import { z } from "zod";
import { ZColor, ZPlacement } from "./common";
import { ZEnvironment } from "./environment";
import { ZStyling } from "./styling";
export const ZProduct = z.object({
id: z.string().cuid2(),
@@ -11,6 +12,7 @@ export const ZProduct = z.object({
teamId: z.string(),
brandColor: ZColor,
highlightBorderColor: ZColor.nullable(),
styling: ZStyling.optional(),
recontactDays: z.number().int(),
inAppSurveyBranding: z.boolean(),
linkSurveyBranding: z.boolean(),

29
packages/types/styling.ts Normal file
View File

@@ -0,0 +1,29 @@
import { z } from "zod";
import { ZColor } from "./common";
export const ZStylingColor = z.object({
light: ZColor,
dark: ZColor.optional(),
});
export const ZCardArrangementOptions = z.enum(["casual", "straight", "simple"]);
export const ZCardArrangement = z.object({
linkSurveys: ZCardArrangementOptions,
inAppSurveys: ZCardArrangementOptions,
});
export const ZStyling = z.object({
brandColor: ZStylingColor,
questionColor: ZStylingColor,
inputColor: ZStylingColor,
inputBorderColor: ZStylingColor,
cardBackgroundColor: ZStylingColor,
highlightBorderColor: ZStylingColor.optional(),
enableDarkMode: z.boolean(),
roundness: z.number(),
cardArrangement: ZCardArrangement,
});
export type TStyling = z.infer<typeof ZStyling>;