feat: add logging and caching enhancements across core services

Integrate `Logger` for consistent logging in services like `reports`, `categories`, `users`, `contents`, and more. Introduce caching capabilities with `CacheInterceptor` and manual cache clearing logic for categories, users, and contents. Add request throttling to critical auth endpoints for enhanced rate limiting.
This commit is contained in:
Mathis HERRIOT
2026-01-10 16:31:06 +01:00
parent 9654553940
commit 5a22ad7480
12 changed files with 129 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
import { Body, Controller, Headers, Post, Req, Res } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { Throttle } from "@nestjs/throttler";
import type { Request, Response } from "express";
import { getIronSession } from "iron-session";
import { AuthService } from "./auth.service";
@@ -16,11 +17,13 @@ export class AuthController {
) {}
@Post("register")
@Throttle({ default: { limit: 5, ttl: 60000 } })
register(@Body() registerDto: RegisterDto) {
return this.authService.register(registerDto);
}
@Post("login")
@Throttle({ default: { limit: 5, ttl: 60000 } })
async login(
@Body() loginDto: LoginDto,
@Headers("user-agent") userAgent: string,
@@ -52,6 +55,7 @@ export class AuthController {
}
@Post("verify-2fa")
@Throttle({ default: { limit: 5, ttl: 60000 } })
async verifyTwoFactor(
@Body() verify2faDto: Verify2faDto,
@Headers("user-agent") userAgent: string,