import { Controller, Get } from "@nestjs/common"; import { CatalogCacheService } from "./services/catalog-cache.service.js"; import type { CatalogCacheSnapshot } from "./services/catalog-cache.service.js"; import { Public } from "@bff/modules/auth/decorators/public.decorator.js"; interface ServicesCacheHealthResponse { timestamp: string; metrics: CatalogCacheSnapshot; ttl: { catalogSeconds: number | null; eligibilitySeconds: number | null; staticSeconds: number | null; volatileSeconds: number; }; } @Controller("health/services") @Public() export class ServicesHealthController { constructor(private readonly catalogCache: CatalogCacheService) {} @Get("cache") getCacheMetrics(): ServicesCacheHealthResponse { const ttl = this.catalogCache.getTtlConfiguration(); return { timestamp: new Date().toISOString(), metrics: this.catalogCache.getMetrics(), ttl, }; } }