mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-09 08:52:39 +00:00
improve healthcheck service
This commit is contained in:
@@ -24,12 +24,6 @@ import { AuthenticationPresenter } from './authentication.presenter';
|
||||
import { RpcValidationPipe } from '../../../../utils/pipes/rpc.validation-pipe';
|
||||
import { UsernamePresenter } from './username.presenter';
|
||||
|
||||
enum ServingStatus {
|
||||
UNKNOWN = 0,
|
||||
SERVING = 1,
|
||||
NOT_SERVING = 2,
|
||||
}
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
whitelist: true,
|
||||
@@ -191,11 +185,4 @@ export class AuthenticationController {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@GrpcMethod('Health', 'Check')
|
||||
async check(): Promise<{ status: ServingStatus }> {
|
||||
return {
|
||||
status: ServingStatus.SERVING,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
import { GrpcMethod } from '@nestjs/microservices';
|
||||
|
||||
enum ServingStatus {
|
||||
UNKNOWN = 0,
|
||||
SERVING = 1,
|
||||
NOT_SERVING = 2,
|
||||
}
|
||||
|
||||
interface HealthCheckRequest {
|
||||
service: string;
|
||||
}
|
||||
|
||||
interface HealthCheckResponse {
|
||||
status: ServingStatus;
|
||||
}
|
||||
|
||||
@Controller()
|
||||
export class HealthController {
|
||||
@GrpcMethod('Health', 'Check')
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
check(data: HealthCheckRequest, metadata: any): HealthCheckResponse {
|
||||
return {
|
||||
status: ServingStatus.SERVING,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user