coupon module
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { IsOptional, IsString, IsBoolean, IsNumber, IsEnum } from 'class-validator';
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { CouponType } from '../entities/coupon.entity';
|
||||
|
||||
export class FindCouponsDto {
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@ApiPropertyOptional({ example: 1, description: 'Page number' })
|
||||
page?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@ApiPropertyOptional({ example: 10, description: 'Items per page' })
|
||||
limit?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ApiPropertyOptional({ example: 'DISCOUNT', description: 'Search term for code or name' })
|
||||
search?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(CouponType)
|
||||
@ApiPropertyOptional({ enum: CouponType, description: 'Filter by coupon type' })
|
||||
type?: CouponType;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Type(() => Boolean)
|
||||
@ApiPropertyOptional({ example: true, description: 'Filter by active status' })
|
||||
isActive?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ApiPropertyOptional({ example: 'createdAt', description: 'Field to order by' })
|
||||
orderBy?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(['asc', 'desc'])
|
||||
@ApiPropertyOptional({ enum: ['asc', 'desc'], example: 'desc', description: 'Sort order' })
|
||||
order?: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user