finance-api/src/modules/transactions/dto/query-transactions.dto.ts
Заид Омар Медхат 33602d0fe9 chore: initialize NestJS project with Docker and environment configuration
Add project scaffolding and development infrastructure:
- Add environment configuration files (.env.development, .env.example) with database, JWT, security, AI integration, logging, and CORS settings
- Add .gitignore to exclude build artifacts, logs, IDE files, and environment variables
- Add .prettierrc with single quotes and trailing commas configuration
- Add multi-stage Dockerfile with development, build, and production stages
- Ad
2025-12-13 15:45:08 +05:00

85 lines
2.1 KiB
TypeScript

import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsEnum, IsDateString, IsUUID, IsNumber, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';
import { TransactionType, PaymentMethod } from '../../../common/constants/categories';
export class QueryTransactionsDto {
@ApiPropertyOptional({
description: 'Номер страницы',
example: 1,
default: 1,
})
@IsOptional()
@Type(() => Number)
@IsNumber()
@Min(1)
page?: number = 1;
@ApiPropertyOptional({
description: 'Количество записей на странице',
example: 20,
default: 20,
})
@IsOptional()
@Type(() => Number)
@IsNumber()
@Min(1)
@Max(100)
limit?: number = 20;
@ApiPropertyOptional({
description: 'Фильтр по типу транзакции',
enum: TransactionType,
})
@IsOptional()
@IsEnum(TransactionType)
type?: TransactionType;
@ApiPropertyOptional({
description: 'Фильтр по категории',
example: '123e4567-e89b-12d3-a456-426614174000',
})
@IsOptional()
@IsUUID('4')
categoryId?: string;
@ApiPropertyOptional({
description: 'Фильтр по способу оплаты',
enum: PaymentMethod,
})
@IsOptional()
@IsEnum(PaymentMethod)
paymentMethod?: PaymentMethod;
@ApiPropertyOptional({
description: 'Дата начала периода (YYYY-MM-DD)',
example: '2024-01-01',
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiPropertyOptional({
description: 'Дата окончания периода (YYYY-MM-DD)',
example: '2024-01-31',
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiPropertyOptional({
description: 'Поиск по описанию',
example: 'продукты',
})
@IsOptional()
search?: string;
@ApiPropertyOptional({
description: 'Сортировка',
enum: ['date_asc', 'date_desc', 'amount_asc', 'amount_desc'],
default: 'date_desc',
})
@IsOptional()
sort?: 'date_asc' | 'date_desc' | 'amount_asc' | 'amount_desc' = 'date_desc';
}