- 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:
2025-03-20 22:53:49 -04:00
parent b9ebdd7080
commit 4046f56191
60 changed files with 233 additions and 30588 deletions

View File

@@ -0,0 +1,34 @@
use crate::session::{session_service_client::SessionServiceClient, GetSessionRequest, GetSessionResponse};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use std::error::Error;
use tonic::transport::Channel;
#[async_trait]
pub trait SessionClientTrait: Sized {
async fn connect(endpoint: &str) -> Result<Self, Box<dyn std::error::Error>>;
async fn get_session(
&mut self,
session_id: String,
) -> Result<GetSessionResponse, Box<dyn std::error::Error>>;
}
#[derive(Clone)]
pub struct SessionClient {
client: SessionServiceClient<Channel>,
}
#[async_trait]
impl SessionClientTrait for SessionClient {
async fn connect(endpoint: &str) -> Result<Self, Box<dyn std::error::Error>> {
let client = SessionServiceClient::connect(endpoint.to_string()).await?;
Ok(Self { client })
}
async fn get_session(&mut self, session_id: String) -> Result<GetSessionResponse, Box<dyn Error>> {
let request = tonic::Request::new(GetSessionRequest {
session_id,
});
let response = self.client.get_session(request).await?;
Ok(response.into_inner())
}
}