Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/correlation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ pub enum CorrelationVersion {
#[serde(rename_all = "camelCase")]
pub struct CorrelationConfig {
pub version: CorrelationVersion,
pub title: String,
pub id: String,
pub table_configs: Vec<TableConfig>,
pub join_config: JoinConfig,
Expand All @@ -164,6 +165,7 @@ impl CorrelationConfig {}
#[serde(rename_all = "camelCase")]
pub struct CorrelationRequest {
pub version: CorrelationVersion,
pub title: String,
pub table_configs: Vec<TableConfig>,
pub join_config: JoinConfig,
pub filter: Option<FilterQuery>,
Expand All @@ -175,6 +177,7 @@ impl From<CorrelationRequest> for CorrelationConfig {
fn from(val: CorrelationRequest) -> Self {
Self {
version: val.version,
title: val.title,
id: get_hash(Utc::now().timestamp_micros().to_string().as_str()),
table_configs: val.table_configs,
join_config: val.join_config,
Expand All @@ -189,6 +192,7 @@ impl CorrelationRequest {
pub fn generate_correlation_config(self, id: String) -> CorrelationConfig {
CorrelationConfig {
version: self.version,
title: self.title,
id,
table_configs: self.table_configs,
join_config: self.join_config,
Expand Down
6 changes: 4 additions & 2 deletions src/handlers/http/correlation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ pub async fn delete(req: HttpRequest) -> Result<impl Responder, CorrelationError

// Delete from disk
let store = CONFIG.storage().get_object_store();
let path =
RelativePathBuf::from_iter([CORRELATIONS_ROOT_DIRECTORY, &correlation.id.to_string()]);
let path = RelativePathBuf::from_iter([
CORRELATIONS_ROOT_DIRECTORY,
&format!("{}.json", correlation_id),
]);
store.delete_object(&path).await?;

// Delete from memory
Expand Down
Loading