48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { Pagination } from '@/utils/types/pagination';
|
|
import { z } from 'zod';
|
|
|
|
export const CreateArticleModel = z.object({
|
|
title: z.string(),
|
|
slug: z.string(),
|
|
description: z.string(),
|
|
coverImageUrl: z.string(),
|
|
content: z.string(),
|
|
authorId: z.string().optional(),
|
|
});
|
|
export type CreateArticleModel = z.infer<typeof CreateArticleModel>;
|
|
|
|
export const UpdateArticleModel = z.object({
|
|
title: z.string().optional(),
|
|
slug: z.string().optional(),
|
|
description: z.string().optional(),
|
|
coverImageUrl: z.string().optional(),
|
|
content: z.string().optional(),
|
|
});
|
|
export type UpdateArticleModel = z.infer<typeof UpdateArticleModel>;
|
|
|
|
export const ArticleModel = z.object({
|
|
id: z.string(),
|
|
title: z.string(),
|
|
slug: z.string(),
|
|
description: z.string(),
|
|
coverImageUrl: z.string(),
|
|
content: z.string(),
|
|
authorId: z.string(),
|
|
externalId: z.uuid(),
|
|
createdAt: z.date(),
|
|
updatedAt: z.date(),
|
|
});
|
|
export type ArticleModel = z.infer<typeof ArticleModel>;
|
|
|
|
export const ArticleInfoModel = z.object({
|
|
externalId: z.uuid(),
|
|
title: z.string(),
|
|
slug: z.string(),
|
|
description: z.string(),
|
|
coverImageUrl: z.string(),
|
|
});
|
|
export type ArticleInfoModel = z.infer<typeof ArticleInfoModel>;
|
|
|
|
export const PaginatedArticlesResult = Pagination(ArticleModel);
|
|
export type PaginatedArticlesResult = z.infer<typeof PaginatedArticlesResult>;
|