import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { PrismaService } from './prisma'; @Injectable() export class AppService { constructor( private readonly configService: ConfigService, private readonly prisma: PrismaService, ) {} getHello(): string { return 'Real Estate Agent Platform API v1.0'; } async getHealth() { const dbHealthy = await this.checkDatabaseHealth(); return { status: 'ok', timestamp: new Date().toISOString(), environment: this.configService.get('app.env'), version: '1.0.0', services: { database: dbHealthy ? 'healthy' : 'unhealthy', }, }; } private async checkDatabaseHealth(): Promise { try { await this.prisma.$queryRaw`SELECT 1`; return true; } catch { return false; } } }