|
@@ -1,5 +1,4 @@
|
|
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
|
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
|
|
|
-import { z } from '@hono/zod-openapi';
|
|
|
|
|
import { WechatPayConfig } from './wechat-pay-config.entity';
|
|
import { WechatPayConfig } from './wechat-pay-config.entity';
|
|
|
|
|
|
|
|
@Entity('wechat_coupon_stocks')
|
|
@Entity('wechat_coupon_stocks')
|
|
@@ -66,52 +65,3 @@ export class WechatCouponStock {
|
|
|
updatedAt!: Date;
|
|
updatedAt!: Date;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Zod Schema定义
|
|
|
|
|
-export const WechatCouponStockSchema = z.object({
|
|
|
|
|
- id: z.number().int().positive().openapi({ description: '批次ID' }),
|
|
|
|
|
- stockId: z.string().max(32).openapi({ description: '微信支付批次号', example: '1234567890' }),
|
|
|
|
|
- stockName: z.string().max(64).openapi({ description: '批次名称', example: '春节代金券' }),
|
|
|
|
|
- stockCreatorMchid: z.string().max(32).openapi({ description: '创建批次的商户号', example: '1234567890' }),
|
|
|
|
|
- couponType: z.string().max(20).openapi({ description: '代金券类型', example: 'NORMAL' }),
|
|
|
|
|
- couponUseRule: z.any().openapi({ description: '代金券使用规则' }),
|
|
|
|
|
- stockSendRule: z.any().openapi({ description: '批次发放规则' }),
|
|
|
|
|
- couponAmount: z.number().int().positive().openapi({ description: '代金券面额(分)', example: 100 }),
|
|
|
|
|
- couponQuantity: z.number().int().positive().openapi({ description: '代金券数量', example: 1000 }),
|
|
|
|
|
- availableQuantity: z.number().int().min(0).openapi({ description: '可用数量', example: 1000 }),
|
|
|
|
|
- distributedQuantity: z.number().int().min(0).default(0).openapi({ description: '已发放数量', example: 0 }),
|
|
|
|
|
- status: z.string().max(20).default('CREATED').openapi({ description: '批次状态', example: 'CREATED' }),
|
|
|
|
|
- startTime: z.date().openapi({ description: '开始时间', example: '2024-01-01T00:00:00Z' }),
|
|
|
|
|
- endTime: z.date().openapi({ description: '结束时间', example: '2024-12-31T23:59:59Z' }),
|
|
|
|
|
- configId: z.number().int().positive().openapi({ description: '微信支付配置ID', example: 1 }),
|
|
|
|
|
- createdBy: z.number().int().positive().nullable().openapi({ description: '创建用户ID', example: 1 }),
|
|
|
|
|
- updatedBy: z.number().int().positive().nullable().openapi({ description: '更新用户ID', example: 1 }),
|
|
|
|
|
- createdAt: z.date().openapi({ description: '创建时间', example: '2024-01-01T00:00:00Z' }),
|
|
|
|
|
- updatedAt: z.date().openapi({ description: '更新时间', example: '2024-01-01T00:00:00Z' })
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-export const CreateWechatCouponStockDto = z.object({
|
|
|
|
|
- stockName: z.string().max(64).openapi({ description: '批次名称', example: '春节代金券' }),
|
|
|
|
|
- stockCreatorMchid: z.string().max(32).openapi({ description: '创建批次的商户号', example: '1234567890' }),
|
|
|
|
|
- couponType: z.string().max(20).openapi({ description: '代金券类型', example: 'NORMAL' }),
|
|
|
|
|
- couponUseRule: z.any().openapi({ description: '代金券使用规则' }),
|
|
|
|
|
- stockSendRule: z.any().openapi({ description: '批次发放规则' }),
|
|
|
|
|
- couponAmount: z.number().int().positive().openapi({ description: '代金券面额(分)', example: 100 }),
|
|
|
|
|
- couponQuantity: z.number().int().positive().openapi({ description: '代金券数量', example: 1000 }),
|
|
|
|
|
- startTime: z.coerce.date().openapi({ description: '开始时间', example: '2024-01-01T00:00:00Z' }),
|
|
|
|
|
- endTime: z.coerce.date().openapi({ description: '结束时间', example: '2024-12-31T23:59:59Z' }),
|
|
|
|
|
- configId: z.number().int().positive().openapi({ description: '微信支付配置ID', example: 1 })
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-export const UpdateWechatCouponStockDto = z.object({
|
|
|
|
|
- stockName: z.string().max(64).optional().openapi({ description: '批次名称', example: '春节代金券' }),
|
|
|
|
|
- couponUseRule: z.any().optional().openapi({ description: '代金券使用规则' }),
|
|
|
|
|
- stockSendRule: z.any().optional().openapi({ description: '批次发放规则' }),
|
|
|
|
|
- couponAmount: z.number().int().positive().optional().openapi({ description: '代金券面额(分)', example: 100 }),
|
|
|
|
|
- couponQuantity: z.number().int().positive().optional().openapi({ description: '代金券数量', example: 1000 }),
|
|
|
|
|
- availableQuantity: z.number().int().min(0).optional().openapi({ description: '可用数量', example: 1000 }),
|
|
|
|
|
- distributedQuantity: z.number().int().min(0).optional().openapi({ description: '已发放数量', example: 0 }),
|
|
|
|
|
- status: z.string().max(20).optional().openapi({ description: '批次状态', example: 'RUNNING' }),
|
|
|
|
|
- startTime: z.coerce.date().optional().openapi({ description: '开始时间', example: '2024-01-01T00:00:00Z' }),
|
|
|
|
|
- endTime: z.coerce.date().optional().openapi({ description: '结束时间', example: '2024-12-31T23:59:59Z' }),
|
|
|
|
|
- configId: z.number().int().positive().optional().openapi({ description: '微信支付配置ID', example: 1 })
|
|
|
|
|
-});
|
|
|