feat(users): enhance user schema and extend service dependencies

Add `email` and `status` fields to user schema for better data handling. Update `UsersService` with new service dependencies (`RbacService`, `MediaService`, `S3Service`, `ConfigService`) for enhanced functionality. Mock dependencies in tests for improved coverage. Adjust user model with optional and extended fields for flexibility. Streamline and update import statements.
This commit is contained in:
Mathis HERRIOT
2026-01-14 21:58:28 +01:00
parent 02d70f27ea
commit 3908989b39
5 changed files with 39 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import {
Injectable,
Logger,
} from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import type { Cache } from "cache-manager";
import { v4 as uuidv4 } from "uuid";
import { RbacService } from "../auth/rbac.service";
@@ -27,6 +28,7 @@ export class UsersService {
private readonly rbacService: RbacService,
@Inject(MediaService) private readonly mediaService: IMediaService,
@Inject(S3Service) private readonly s3Service: IStorageService,
private readonly configService: ConfigService,
) {}
private async clearUserCache(username?: string) {
@@ -114,9 +116,7 @@ export class UsersService {
}
if (file.size > 2 * 1024 * 1024) {
throw new BadRequestException(
"Image trop volumineuse. Limite: 2 Mo.",
);
throw new BadRequestException("Image trop volumineuse. Limite: 2 Mo.");
}
// 1. Scan Antivirus