diff --git a/src/modules/authentication/adapters/primaries/authentication.controller.ts b/src/modules/authentication/adapters/primaries/authentication.controller.ts index 3fb7032..8936ac5 100644 --- a/src/modules/authentication/adapters/primaries/authentication.controller.ts +++ b/src/modules/authentication/adapters/primaries/authentication.controller.ts @@ -24,6 +24,12 @@ 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, @@ -185,4 +191,11 @@ export class AuthenticationController { }); } } + + @GrpcMethod('Health', 'Check') + async check(): Promise<{ status: ServingStatus }> { + return { + status: ServingStatus.SERVING, + }; + } } diff --git a/src/modules/authentication/adapters/primaries/authentication.proto b/src/modules/authentication/adapters/primaries/authentication.proto index 9b16d3a..472ff2a 100644 --- a/src/modules/authentication/adapters/primaries/authentication.proto +++ b/src/modules/authentication/adapters/primaries/authentication.proto @@ -40,3 +40,20 @@ message Uuid { } 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; +}