- removed: api-service
- removed: session-service - updated: moved health check out of consul registration - updated: get service info to pull the service from the default namespace for the service account - updated: the rest of the services to be able to handle the new database tables
This commit is contained in:
25
database-service/src/grpc/session_service.rs
Normal file
25
database-service/src/grpc/session_service.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use crate::grpc::database_service::MyDatabaseService;
|
||||
use crate::grpc::session_service_server::SessionService;
|
||||
use tonic::{Request, Response, Status};
|
||||
use tracing::debug;
|
||||
use crate::grpc::{GetSessionRequest, GetSessionResponse};
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl SessionService for MyDatabaseService {
|
||||
async fn get_session(
|
||||
&self,
|
||||
request: Request<GetSessionRequest>,
|
||||
) -> Result<Response<GetSessionResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
debug!("get_session: {:?}", req);
|
||||
|
||||
let session = self.db.session_repo.get_session(&req.session_id).await
|
||||
.map_err(|_| Status::not_found("Session not found"))?;
|
||||
|
||||
debug!("session: {:?}", session);
|
||||
Ok(Response::new(GetSessionResponse {
|
||||
session_id: session.id,
|
||||
user_id: session.user_id,
|
||||
}))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user