feat: Initialize NestJS backend project with Prisma, core modules, configuration, and common utilities.

This commit is contained in:
pradeepkumar
2025-12-18 23:05:04 +05:30
commit 7990846711
28 changed files with 21284 additions and 0 deletions

38
src/app.service.ts Normal file
View File

@@ -0,0 +1,38 @@
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<string>('app.env'),
version: '1.0.0',
services: {
database: dbHealthy ? 'healthy' : 'unhealthy',
},
};
}
private async checkDatabaseHealth(): Promise<boolean> {
try {
await this.prisma.$queryRaw`SELECT 1`;
return true;
} catch {
return false;
}
}
}