Merge branch 'healthservice' into 'main'

add health service

See merge request v3/service/auth!27
This commit is contained in:
Sylvain Briat 2023-03-30 14:44:53 +00:00
commit ffd4108419
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;
}