feat: add pagination, sorting and filtering

This commit is contained in:
2026-06-07 12:58:38 +03:30
parent 28c1a4831e
commit d1fecf62ad
19 changed files with 389 additions and 176 deletions
+3 -10
View File
@@ -1,15 +1,11 @@
import {
HttpStatus,
Injectable,
RequestTimeoutException,
UnauthorizedException,
} from '@nestjs/common';
import { HttpStatus, Injectable, UnauthorizedException } from '@nestjs/common';
import { LessThan, MoreThanOrEqual, Repository } from 'typeorm';
import { OTP } from '../entities/otp.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { Cron } from '@nestjs/schedule';
import { HashingProvider } from '@/common/modules/hashing/providers/hashing.provider';
import { AppException } from '@/common/exceptions/app.exception';
import { AppTimeoutException } from '@/common/exceptions/app-timeout.exception';
@Injectable()
export class OtpService {
@@ -73,10 +69,7 @@ export class OtpService {
order: { createdAt: 'DESC' },
});
} catch (err) {
throw new RequestTimeoutException('common.errors.requestTimeout', {
cause: err,
description: 'Error connecting to the database',
});
throw new AppTimeoutException(err);
}
if (!otp) throw new UnauthorizedException('auth.errors.invalidOTP');