import type { CallHandler , ExecutionContext , NestInterceptor , } from '@nestjs/common' ; import { Injectable } from '@nestjs/common' ; import type { Observable } from 'rxjs' ; import { mergeMap } from 'rxjs/operators' ; import type { AbstractDto } from '../common/dto/abstract.dto' ; import { TranslationService } from '../shared/services/translation.service' ; @ Injectable ( ) export class TranslationInterceptor implements NestInterceptor { constructor ( private readonly translationService ) { } public intercept ( _context , next ) { return next . handle ( ) . pipe ( mergeMap ( ( data ) => this . translationService . translateNecessaryKeys < AbstractDto > ( data ) ) ) ; } }