|
|
@@ -3,11 +3,6 @@ import { GoodsCategorySchema } from './goods-category.schema';
|
|
|
import { SupplierSchema } from '@/server/modules/supplier/supplier.schema';
|
|
|
import { FileSchema } from '@/server/modules/files/file.schema';
|
|
|
|
|
|
-const SlideImagesSchema = z.array(z.string()).nullable().optional().openapi({
|
|
|
- description: '商品轮播图URL数组',
|
|
|
- example: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg']
|
|
|
-});
|
|
|
-
|
|
|
export const GoodsSchema = z.object({
|
|
|
id: z.number().int().positive().openapi({ description: '商品ID' }),
|
|
|
name: z.string().min(1, '商品名称不能为空').max(255, '商品名称最多255个字符').openapi({
|
|
|
@@ -54,7 +49,16 @@ export const GoodsSchema = z.object({
|
|
|
description: '商品主图文件ID',
|
|
|
example: 1
|
|
|
}),
|
|
|
- slideImages: SlideImagesSchema,
|
|
|
+ slideImages: z.array(FileSchema).nullable().optional().openapi({
|
|
|
+ description: '商品轮播图文件列表',
|
|
|
+ example: [{
|
|
|
+ id: 1,
|
|
|
+ name: 'image1.jpg',
|
|
|
+ fullUrl: 'https://example.com/image1.jpg',
|
|
|
+ type: 'image/jpeg',
|
|
|
+ size: 102400
|
|
|
+ }]
|
|
|
+ }),
|
|
|
detail: z.string().nullable().optional().openapi({
|
|
|
description: '商品详情',
|
|
|
example: '这是商品详情内容'
|
|
|
@@ -157,7 +161,10 @@ export const CreateGoodsDto = z.object({
|
|
|
description: '商品主图文件ID',
|
|
|
example: 1
|
|
|
}),
|
|
|
- slideImages: SlideImagesSchema,
|
|
|
+ slideImageIds: z.array(z.number().int().positive()).nullable().optional().openapi({
|
|
|
+ description: '商品轮播图文件ID数组',
|
|
|
+ example: [1, 2, 3]
|
|
|
+ }),
|
|
|
detail: z.string().nullable().optional().openapi({
|
|
|
description: '商品详情',
|
|
|
example: '这是商品详情内容'
|
|
|
@@ -229,7 +236,10 @@ export const UpdateGoodsDto = z.object({
|
|
|
description: '商品主图文件ID',
|
|
|
example: 1
|
|
|
}),
|
|
|
- slideImages: SlideImagesSchema,
|
|
|
+ slideImageIds: z.array(z.number().int().positive()).nullable().optional().openapi({
|
|
|
+ description: '商品轮播图文件ID数组',
|
|
|
+ example: [1, 2, 3]
|
|
|
+ }),
|
|
|
detail: z.string().nullable().optional().openapi({
|
|
|
description: '商品详情',
|
|
|
example: '这是商品详情内容'
|