coupon module

This commit is contained in:
2025-12-06 12:50:51 +03:30
parent 7a5b181af2
commit 816cb639e7
15 changed files with 804 additions and 3 deletions
@@ -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';
}