|
@@ -0,0 +1,35 @@
|
|
|
|
|
+import { z } from '@hono/zod-openapi';
|
|
|
|
|
+
|
|
|
|
|
+export const CouponLogSchema = z.object({
|
|
|
|
|
+ id: z.number().int().positive().openapi({ description: '领券日志ID' }),
|
|
|
|
|
+ couponId: z.string().openapi({ description: '券ID', example: 'COUPON123456789' }),
|
|
|
|
|
+ batchId: z.string().openapi({ description: '批次号', example: 'BATCH202412010001' }),
|
|
|
|
|
+ batchCategoryId: z.number().int().positive().openapi({ description: '批次分类ID', example: 1 }),
|
|
|
|
|
+ exchangeCodeId: z.number().int().positive().openapi({ description: '兑换码ID', example: 1001 }),
|
|
|
|
|
+ userId: z.number().int().positive().openapi({ description: '用户ID', example: 123 }),
|
|
|
|
|
+ result: z.number().int().min(0).max(1).openapi({ description: '领取结果:0-失败,1-成功', example: 1 }),
|
|
|
|
|
+ failReason: z.string().nullable().openapi({ description: '失败原因', example: '库存不足' }),
|
|
|
|
|
+ isDeleted: z.number().int().min(0).max(1).openapi({ description: '是否删除:0-未删除,1-已删除', example: 0 }),
|
|
|
|
|
+ createdAt: z.date().openapi({ description: '创建时间', example: '2024-01-01T12:00:00Z' }),
|
|
|
|
|
+ updatedAt: z.date().openapi({ description: '更新时间', example: '2024-01-01T12:00:00Z' })
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+export const CreateCouponLogDto = z.object({
|
|
|
|
|
+ couponId: z.string().openapi({ description: '券ID', example: 'COUPON123456789' }),
|
|
|
|
|
+ batchId: z.string().openapi({ description: '批次号', example: 'BATCH202412010001' }),
|
|
|
|
|
+ batchCategoryId: z.coerce.number().int().positive().openapi({ description: '批次分类ID', example: 1 }),
|
|
|
|
|
+ exchangeCodeId: z.coerce.number().int().positive().openapi({ description: '兑换码ID', example: 1001 }),
|
|
|
|
|
+ userId: z.coerce.number().int().positive().openapi({ description: '用户ID', example: 123 }),
|
|
|
|
|
+ result: z.coerce.number().int().min(0).max(1).openapi({ description: '领取结果:0-失败,1-成功', example: 1 }),
|
|
|
|
|
+ failReason: z.string().nullable().optional().openapi({ description: '失败原因', example: '库存不足' })
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+export const UpdateCouponLogDto = z.object({
|
|
|
|
|
+ couponId: z.string().optional().openapi({ description: '券ID', example: 'COUPON123456789' }),
|
|
|
|
|
+ batchId: z.string().optional().openapi({ description: '批次号', example: 'BATCH202412010001' }),
|
|
|
|
|
+ batchCategoryId: z.coerce.number().int().positive().optional().openapi({ description: '批次分类ID', example: 1 }),
|
|
|
|
|
+ exchangeCodeId: z.coerce.number().int().positive().optional().openapi({ description: '兑换码ID', example: 1001 }),
|
|
|
|
|
+ userId: z.coerce.number().int().positive().optional().openapi({ description: '用户ID', example: 123 }),
|
|
|
|
|
+ result: z.coerce.number().int().min(0).max(1).optional().openapi({ description: '领取结果:0-失败,1-成功', example: 1 }),
|
|
|
|
|
+ failReason: z.string().nullable().optional().openapi({ description: '失败原因', example: '库存不足' })
|
|
|
|
|
+});
|