22 lines
671 B
TypeScript
22 lines
671 B
TypeScript
import { IsNotEmpty, IsString, IsNumber, IsOptional } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class ValidateCouponDto {
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
@ApiProperty({ example: 'DISCOUNT10', description: 'Coupon code to validate' })
|
|
code!: string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ example: 150000, description: 'Order total amount for validation' })
|
|
orderAmount?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'user-id', description: 'User ID for per-user usage limits' })
|
|
userId?: string;
|
|
}
|