[REF] Remove TypeORM, Implement Drizzle Health Indicator
Priority: Medium
Difficulty: Medium
Estimated Effort: 1-2 days
Relevant Packages: OrbitStream_backend/
Labels: refactor, enhancement, priority:medium
Requirements
1. Remove TypeORM
- Remove
TypeOrmModule.forRoot() from app.module.ts
- Remove
TypeOrmModule import from app.module.ts
- Remove
@nestjs/typeorm and typeorm from package.json dependencies
- Verify no other file imports from TypeORM
- Run
npm install to clean up node_modules
2. Drizzle Health Indicator
Create a DrizzleHealthIndicator that implements @nestjs/terminus HealthIndicator interface:
// src/monitoring/drizzle-health.indicator.ts
import { HealthIndicator, HealthIndicatorResult } from '@nestjs/terminus';
import { db } from '../db/index';
export class DrizzleHealthIndicator extends HealthIndicator {
async pingCheck(key: string): Promise<HealthIndicatorResult> {
try {
// Execute a simple query to verify Drizzle connection
await db.execute(sql`SELECT 1`);
return this.getStatus(key, true);
} catch (error) {
return this.getStatus(key, false, { message: error.message });
}
}
}
3. Update Health Controller
- Replace
TypeOrmHealthIndicator with DrizzleHealthIndicator in health.controller.ts
- Update constructor injection
- Verify the health endpoint returns correct status
4. Testing
- Unit test
DrizzleHealthIndicator: mock db.execute, test success and failure cases
- Integration test: verify
GET /health returns {"status":"ok"} when DB is connected
- Integration test: verify
GET /health returns {"status":"error"} when DB is unreachable
- Verify no TypeORM references remain in the codebase
[REF] Remove TypeORM, Implement Drizzle Health Indicator
Priority: Medium
Difficulty: Medium
Estimated Effort: 1-2 days
Relevant Packages:
OrbitStream_backend/Labels:
refactor,enhancement,priority:mediumRequirements
1. Remove TypeORM
TypeOrmModule.forRoot()fromapp.module.tsTypeOrmModuleimport fromapp.module.ts@nestjs/typeormandtypeormfrompackage.jsondependenciesnpm installto clean upnode_modules2. Drizzle Health Indicator
Create a
DrizzleHealthIndicatorthat implements@nestjs/terminusHealthIndicatorinterface:3. Update Health Controller
TypeOrmHealthIndicatorwithDrizzleHealthIndicatorinhealth.controller.ts4. Testing
DrizzleHealthIndicator: mockdb.execute, test success and failure casesGET /healthreturns{"status":"ok"}when DB is connectedGET /healthreturns{"status":"error"}when DB is unreachable