|
@@ -36,6 +36,15 @@ export class SilverKnowledge {
|
|
|
@Column({ name: 'like_count', type: 'int', default: 0 })
|
|
@Column({ name: 'like_count', type: 'int', default: 0 })
|
|
|
likeCount!: number;
|
|
likeCount!: number;
|
|
|
|
|
|
|
|
|
|
+ @Column({ name: 'cover_image', type: 'varchar', length: 500, nullable: true })
|
|
|
|
|
+ coverImage!: string | null;
|
|
|
|
|
+
|
|
|
|
|
+ @Column({ name: 'attachment', type: 'varchar', length: 500, nullable: true })
|
|
|
|
|
+ attachment!: string | null;
|
|
|
|
|
+
|
|
|
|
|
+ @Column({ name: 'attachment_name', type: 'varchar', length: 255, nullable: true })
|
|
|
|
|
+ attachmentName!: string | null;
|
|
|
|
|
+
|
|
|
@Column({ name: 'user_id', type: 'int', unsigned: true })
|
|
@Column({ name: 'user_id', type: 'int', unsigned: true })
|
|
|
userId!: number;
|
|
userId!: number;
|
|
|
|
|
|
|
@@ -62,6 +71,9 @@ export const SilverKnowledgeSchema = z.object({
|
|
|
status: z.number().int().min(0).max(1).openapi({ description: '状态(0-草稿,1-发布)', example: 1 }),
|
|
status: z.number().int().min(0).max(1).openapi({ description: '状态(0-草稿,1-发布)', example: 1 }),
|
|
|
viewCount: z.number().int().nonnegative().openapi({ description: '浏览次数', example: 100 }),
|
|
viewCount: z.number().int().nonnegative().openapi({ description: '浏览次数', example: 100 }),
|
|
|
likeCount: z.number().int().nonnegative().openapi({ description: '点赞次数', example: 25 }),
|
|
likeCount: z.number().int().nonnegative().openapi({ description: '点赞次数', example: 25 }),
|
|
|
|
|
+ coverImage: z.string().nullable().openapi({ description: '封面图片URL', example: 'https://example.com/cover.jpg' }),
|
|
|
|
|
+ attachment: z.string().nullable().openapi({ description: '附件文件URL', example: 'https://example.com/attachment.pdf' }),
|
|
|
|
|
+ attachmentName: z.string().nullable().openapi({ description: '附件原始文件名', example: '健康知识文档.pdf' }),
|
|
|
userId: z.number().int().positive().openapi({ description: '用户ID', example: 1 }),
|
|
userId: z.number().int().positive().openapi({ description: '用户ID', example: 1 }),
|
|
|
createdAt: z.date().openapi({ description: '创建时间', example: '2024-01-01T00:00:00Z' }),
|
|
createdAt: z.date().openapi({ description: '创建时间', example: '2024-01-01T00:00:00Z' }),
|
|
|
updatedAt: z.date().openapi({ description: '更新时间', example: '2024-01-01T00:00:00Z' })
|
|
updatedAt: z.date().openapi({ description: '更新时间', example: '2024-01-01T00:00:00Z' })
|
|
@@ -73,7 +85,10 @@ export const CreateSilverKnowledgeDto = z.object({
|
|
|
categoryId: z.coerce.number().int().positive().openapi({ description: '分类ID', example: 1 }),
|
|
categoryId: z.coerce.number().int().positive().openapi({ description: '分类ID', example: 1 }),
|
|
|
tags: z.string().nullable().optional().openapi({ description: '标签,逗号分隔', example: '健康,养生,老年人' }),
|
|
tags: z.string().nullable().optional().openapi({ description: '标签,逗号分隔', example: '健康,养生,老年人' }),
|
|
|
author: z.string().max(100).openapi({ description: '作者', example: '张医生' }),
|
|
author: z.string().max(100).openapi({ description: '作者', example: '张医生' }),
|
|
|
- status: z.coerce.number().int().min(0).max(1).default(1).openapi({ description: '状态(0-草稿,1-发布)', example: 1 })
|
|
|
|
|
|
|
+ status: z.coerce.number().int().min(0).max(1).default(1).openapi({ description: '状态(0-草稿,1-发布)', example: 1 }),
|
|
|
|
|
+ coverImage: z.string().nullable().optional().openapi({ description: '封面图片URL', example: 'https://example.com/cover.jpg' }),
|
|
|
|
|
+ attachment: z.string().nullable().optional().openapi({ description: '附件文件URL', example: 'https://example.com/attachment.pdf' }),
|
|
|
|
|
+ attachmentName: z.string().nullable().optional().openapi({ description: '附件原始文件名', example: '健康知识文档.pdf' })
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export const UpdateSilverKnowledgeDto = z.object({
|
|
export const UpdateSilverKnowledgeDto = z.object({
|
|
@@ -82,5 +97,8 @@ export const UpdateSilverKnowledgeDto = z.object({
|
|
|
categoryId: z.coerce.number().int().positive().optional().openapi({ description: '分类ID', example: 1 }),
|
|
categoryId: z.coerce.number().int().positive().optional().openapi({ description: '分类ID', example: 1 }),
|
|
|
tags: z.string().nullable().optional().openapi({ description: '标签,逗号分隔', example: '健康,养生,老年人' }),
|
|
tags: z.string().nullable().optional().openapi({ description: '标签,逗号分隔', example: '健康,养生,老年人' }),
|
|
|
author: z.string().max(100).optional().openapi({ description: '作者', example: '张医生' }),
|
|
author: z.string().max(100).optional().openapi({ description: '作者', example: '张医生' }),
|
|
|
- status: z.coerce.number().int().min(0).max(1).optional().openapi({ description: '状态(0-草稿,1-发布)', example: 1 })
|
|
|
|
|
|
|
+ status: z.coerce.number().int().min(0).max(1).optional().openapi({ description: '状态(0-草稿,1-发布)', example: 1 }),
|
|
|
|
|
+ coverImage: z.string().nullable().optional().openapi({ description: '封面图片URL', example: 'https://example.com/cover.jpg' }),
|
|
|
|
|
+ attachment: z.string().nullable().optional().openapi({ description: '附件文件URL', example: 'https://example.com/attachment.pdf' }),
|
|
|
|
|
+ attachmentName: z.string().nullable().optional().openapi({ description: '附件原始文件名', example: '健康知识文档.pdf' })
|
|
|
});
|
|
});
|