refactor(api): replace new Logger() with DI LoggerService and split large files
- Migrate 30 files from `new Logger(ClassName.name)` to injected LoggerService for consistent PII masking and centralized logging config - Split prisma-admin-query.repository.ts (313→121 lines) into admin-stats.queries.ts and admin-user.queries.ts - Split admin.controller.ts (285→154 lines) into admin-moderation.controller.ts - Split prisma-listing.repository.ts (274→111 lines) into listing-read.queries.ts - Update 28 test files with mock LoggerService - All 831 tests passing, zero direct new Logger() calls remaining Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { type LoggerService } from '@modules/shared';
|
||||
|
||||
export interface AiPredictRequest {
|
||||
area: number;
|
||||
@@ -51,12 +52,11 @@ export interface IAiServiceClient {
|
||||
|
||||
@Injectable()
|
||||
export class AiServiceClient implements IAiServiceClient {
|
||||
private readonly logger = new Logger(AiServiceClient.name);
|
||||
private readonly baseUrl: string;
|
||||
private readonly apiKey: string;
|
||||
private readonly timeoutMs: number;
|
||||
|
||||
constructor() {
|
||||
constructor(private readonly logger: LoggerService) {
|
||||
this.baseUrl = process.env['AI_SERVICE_URL'] ?? 'http://localhost:8000';
|
||||
this.apiKey = process.env['AI_SERVICE_API_KEY'] ?? '';
|
||||
this.timeoutMs = Number(process.env['AI_SERVICE_TIMEOUT_MS']) || 5000;
|
||||
|
||||
Reference in New Issue
Block a user