chore: add user get profile and check validity route

This commit is contained in:
mahyargdz
2025-01-22 09:50:03 +03:30
parent 7431dad85f
commit 72b6cb35a0
39 changed files with 874 additions and 127 deletions
+11
View File
@@ -0,0 +1,11 @@
import { ConfigService } from "@nestjs/config";
import { JwtModuleAsyncOptions } from "@nestjs/jwt";
export function jwtConfig(): JwtModuleAsyncOptions {
return {
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
secret: configService.getOrThrow<string>("JWT_SECRET_KEY"),
}),
};
}
+21
View File
@@ -0,0 +1,21 @@
import { ThrottlerStorageRedisService } from "@nest-lab/throttler-storage-redis";
import { ConfigService } from "@nestjs/config";
import { ThrottlerAsyncOptions } from "@nestjs/throttler";
import { AuthMessage } from "../common/enums/message.enum";
export function rateLimitConfig(): ThrottlerAsyncOptions {
return {
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
throttlers: [
{
ttl: configService.getOrThrow("THROTTLE_TTL"),
limit: configService.getOrThrow("THROTTLE_LIMIT"),
},
],
errorMessage: AuthMessage.TOO_MANY_REQUESTS,
storage: new ThrottlerStorageRedisService(configService.getOrThrow("REDIS_URI")),
}),
};
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { ConfigService } from "@nestjs/config";
export function SmsConfigs() {
export function smsConfigs() {
return {
inject: [ConfigService],
useFactory(configService: ConfigService) {
+11
View File
@@ -5,6 +5,17 @@ export function getSwaggerDocument(app: NestFastifyApplication) {
const swaggerConfig = new DocumentBuilder()
.setTitle("The Danak dsc api document")
.setDescription("The Danak dsc API description")
.addBearerAuth(
{
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
name: "authorization",
in: "header",
},
"authorization",
)
.setVersion("1.0.0")
.build();
+1 -1
View File
@@ -1,7 +1,7 @@
import { ConfigService } from "@nestjs/config";
import { TypeOrmModuleAsyncOptions } from "@nestjs/typeorm";
export function DatabaseConfigs(): TypeOrmModuleAsyncOptions {
export function databaseConfigs(): TypeOrmModuleAsyncOptions {
return {
inject: [ConfigService],
useFactory(configService: ConfigService) {