add health service

This commit is contained in:
sbriat 2023-03-30 16:37:21 +02:00
parent 340eecb7d8
commit 5e36525358
2 changed files with 30 additions and 0 deletions

View File

@ -24,6 +24,12 @@ import { AuthenticationPresenter } from './authentication.presenter';
import { RpcValidationPipe } from '../../../../utils/pipes/rpc.validation-pipe'; import { RpcValidationPipe } from '../../../../utils/pipes/rpc.validation-pipe';
import { UsernamePresenter } from './username.presenter'; import { UsernamePresenter } from './username.presenter';
enum ServingStatus {
UNKNOWN = 0,
SERVING = 1,
NOT_SERVING = 2,
}
@UsePipes( @UsePipes(
new RpcValidationPipe({ new RpcValidationPipe({
whitelist: true, whitelist: true,
@ -185,4 +191,11 @@ export class AuthenticationController {
}); });
} }
} }
@GrpcMethod('Health', 'Check')
async check(): Promise<{ status: ServingStatus }> {
return {
status: ServingStatus.SERVING,
};
}
} }

View File

@ -40,3 +40,20 @@ message Uuid {
} }
message Empty {} message Empty {}
service Health {
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
}
message HealthCheckRequest {
string service = 1;
}
message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}
ServingStatus status = 1;
}