refactor: adjust imports and streamline code for consistency

- Reorganized import statements in multiple files for better readability.
- Refined `auth.service` to remove unused `email` variable in `login` function.
- Cleaned up whitespace and formatting in `http-exception.filter.spec.ts`.
This commit is contained in:
Mathis HERRIOT
2026-02-09 11:45:12 +01:00
parent e27a98ca89
commit 1ab6e1a969
4 changed files with 8 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ export class AuthService {
async login(dto: LoginDto, userAgent?: string, ip?: string) {
const emailHash = await this.hashingService.hashEmail(dto.email);
this.logger.log(`Login attempt for email hash: ${emailHash}`);
const { email, password } = dto;
const { password } = dto;
const user = await this.usersService.findByEmailHash(emailHash);
if (!user) {

View File

@@ -49,9 +49,11 @@ describe("AllExceptionsFilter", () => {
filter.catch(exception, mockArgumentsHost);
expect(mockResponse.status).toHaveBeenCalledWith(HttpStatus.INTERNAL_SERVER_ERROR);
expect(mockResponse.status).toHaveBeenCalledWith(
HttpStatus.INTERNAL_SERVER_ERROR,
);
expect(Sentry.withScope).toHaveBeenCalled();
// Vérifier que captureException a été appelé (via withScope)
expect(Sentry.captureException).toHaveBeenCalledWith(exception);
});
@@ -79,7 +81,7 @@ describe("AllExceptionsFilter", () => {
filter.catch(exception, mockArgumentsHost);
expect(mockResponse.status).toHaveBeenCalledWith(HttpStatus.BAD_REQUEST);
// L'IP 1.2.3.4 hachée en SHA256 contient un hash de 64 caractères
const logCall = loggerSpy.mock.calls[0][0];
expect(logCall).toMatch(/[a-f0-9]{64}/);

View File

@@ -1,3 +1,4 @@
import { createHash } from "node:crypto";
import {
ArgumentsHost,
Catch,
@@ -6,7 +7,6 @@ import {
HttpStatus,
Logger,
} from "@nestjs/common";
import { createHash } from "node:crypto";
import * as Sentry from "@sentry/nestjs";
import { Request, Response } from "express";

View File

@@ -1,7 +1,7 @@
import { createHash } from "node:crypto";
import { CACHE_MANAGER } from "@nestjs/cache-manager";
import { Inject, Injectable, Logger, NestMiddleware } from "@nestjs/common";
import type { Cache } from "cache-manager";
import { createHash } from "node:crypto";
import type { NextFunction, Request, Response } from "express";
@Injectable()