34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const cmsTypeEnum = z.enum(["splash", "promo", "article", "banner", "floatingWidget"]);
|
|
export const corpTypeEnum = z.enum(["walanja", "simaya", "cifo"]);
|
|
|
|
export const contentSchema = z.object({
|
|
title: z.string().min(1, "Title is required"),
|
|
description: z.string().nullable().optional(),
|
|
image: z.any().optional(),
|
|
type: cmsTypeEnum,
|
|
corp: corpTypeEnum,
|
|
targetUrl: z.string().url("Invalid URL").optional().or(z.literal("")),
|
|
});
|
|
|
|
export const contentUpdateSchema = contentSchema.partial();
|
|
|
|
export type ContentInput = z.infer<typeof contentSchema>;
|
|
export type ContentUpdateInput = z.infer<typeof contentUpdateSchema>;
|
|
export type CmsType = z.infer<typeof cmsTypeEnum>;
|
|
export type CorpType = z.infer<typeof corpTypeEnum>;
|
|
|
|
export interface Content {
|
|
UUID_APC: string;
|
|
Title_APC: string;
|
|
Content_APC?: string;
|
|
Type_APC: CmsType;
|
|
CorpType_APC: CorpType;
|
|
Url_APC?: string;
|
|
Filename_APC?: string;
|
|
TargetUrl_APC?: string;
|
|
UpdatedAt_APC: string;
|
|
CreatedAt_APC: string;
|
|
}
|