Assist_Design/apps/bff/src/modules/services/services-health.controller.ts
barsa 38bb40b88b Add Service and Component Structure for Internet and SIM Offerings
- Introduced new controllers for internet eligibility and service health checks to enhance backend functionality.
- Created service modules for internet, SIM, and VPN offerings, improving organization and maintainability.
- Developed various components for internet and SIM configuration, including forms and plan cards, to streamline user interactions.
- Implemented hooks for managing service configurations and eligibility checks, enhancing frontend data handling.
- Updated utility functions for pricing and catalog operations to support new service structures and improve performance.
2025-12-25 13:20:45 +09:00

32 lines
932 B
TypeScript

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,
};
}
}