Removing Prisma and Grapql-nestjs-prisma resolvers (#2574)
* Some cleaning * Fix seeds * Fix all sign in, sign up flow and apiKey optimistic rendering * Fix
This commit is contained in:
@ -2,7 +2,6 @@ import { HealthCheckService, HttpHealthIndicator } from '@nestjs/terminus';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { HealthController } from 'src/health/health.controller';
|
||||
import { PrismaHealthIndicator } from 'src/health/indicators/prisma-health-indicator';
|
||||
|
||||
describe('HealthController', () => {
|
||||
let healthController: HealthController;
|
||||
@ -16,10 +15,6 @@ describe('HealthController', () => {
|
||||
provide: HealthCheckService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: PrismaHealthIndicator,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: HttpHealthIndicator,
|
||||
useValue: {},
|
||||
|
||||
@ -1,20 +1,13 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { HealthCheck, HealthCheckService } from '@nestjs/terminus';
|
||||
|
||||
import { PrismaHealthIndicator } from 'src/health/indicators/prisma-health-indicator';
|
||||
|
||||
@Controller('healthz')
|
||||
export class HealthController {
|
||||
constructor(
|
||||
private health: HealthCheckService,
|
||||
private prismaHealthIndicator: PrismaHealthIndicator,
|
||||
) {}
|
||||
constructor(private health: HealthCheckService) {}
|
||||
|
||||
@Get()
|
||||
@HealthCheck()
|
||||
check() {
|
||||
return this.health.check([
|
||||
() => this.prismaHealthIndicator.isDatabaseInstanceHealthy('database'),
|
||||
]);
|
||||
return this.health.check([]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TerminusModule } from '@nestjs/terminus';
|
||||
|
||||
import { PrismaModule } from 'src/database/prisma.module';
|
||||
import { HealthController } from 'src/health/health.controller';
|
||||
import { PrismaHealthIndicator } from 'src/health/indicators/prisma-health-indicator';
|
||||
|
||||
@Module({
|
||||
imports: [TerminusModule, PrismaModule],
|
||||
imports: [TerminusModule],
|
||||
controllers: [HealthController],
|
||||
providers: [PrismaHealthIndicator],
|
||||
})
|
||||
export class HealthModule {}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
HealthCheckError,
|
||||
HealthIndicator,
|
||||
HealthIndicatorResult,
|
||||
} from '@nestjs/terminus';
|
||||
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
export class PrismaHealthIndicator extends HealthIndicator {
|
||||
constructor(private readonly prismaService: PrismaService) {
|
||||
super();
|
||||
}
|
||||
|
||||
async isDatabaseInstanceHealthy(key: string): Promise<HealthIndicatorResult> {
|
||||
try {
|
||||
await this.prismaService.client.$queryRaw`SELECT 1`;
|
||||
return this.getStatus(key, true);
|
||||
} catch (e) {
|
||||
throw new HealthCheckError('Prisma check failed', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user