fix(settings): add validated SmsLogQueryDto to allow pagination and filter queries on sms logs
All checks were successful
Deploy Canina / deploy (push) Successful in 1m42s
All checks were successful
Deploy Canina / deploy (push) Successful in 1m42s
This commit is contained in:
parent
e82d2b88c1
commit
2984b9f637
42
backend/src/settings/dto/sms-log-query.dto.ts
Normal file
42
backend/src/settings/dto/sms-log-query.dto.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { IsOptional, IsString, IsNumber, IsIn } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class SmsLogQueryDto {
|
||||
@ApiPropertyOptional({ description: 'شماره صفحه', example: 1 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
page?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'تعداد آیتمها در صفحه', example: 15 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
limit?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'جستجو در گیرنده، پیام یا شناسه', example: '0912' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
search?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'فیلتر نوع پیامک', example: 'OTP' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'فیلتر وضعیت پیامک', example: 'SUCCESS' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'مرتبسازی بر اساس فیلد', example: 'createdAt' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sortBy?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'ترتیب مرتبسازی', example: 'desc', enum: ['asc', 'desc'] })
|
||||
@IsOptional()
|
||||
@IsIn(['asc', 'desc'])
|
||||
sortOrder?: 'asc' | 'desc';
|
||||
}
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { SettingsService, ScientificTermData } from './settings.service';
|
||||
import { SmsLogQuery } from '../common/services/sms.service';
|
||||
import { SmsLogQueryDto } from './dto/sms-log-query.dto';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
@ -204,7 +204,7 @@ export class SettingsController {
|
||||
@ApiOperation({
|
||||
summary: 'دریافت گزارشات و لاگهای کامل پیامکهای ارسالی با فیلتر و جستجو',
|
||||
})
|
||||
getSmsLogs(@Query() query: SmsLogQuery) {
|
||||
getSmsLogs(@Query() query: SmsLogQueryDto) {
|
||||
return this.settingsService.getSmsLogs(query);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user