add health service
This commit is contained in:
		
							parent
							
								
									340eecb7d8
								
							
						
					
					
						commit
						5e36525358
					
				| 
						 | 
				
			
			@ -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,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue