credentials instead of value

This commit is contained in:
dal 2025-03-21 11:46:20 -06:00
parent 52f0caf5be
commit 5729d34f8c
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ use database::{
};
use diesel::{ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
use query_engine::credentials::Credential;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use uuid::Uuid;
@ -25,7 +26,7 @@ pub struct DataSourceResponse {
pub created_at: String,
pub updated_at: String,
pub created_by: CreatedByResponse,
pub credentials: Value,
pub credentials: Credential,
pub data_sets: Vec<DatasetResponse>,
}
@ -74,8 +75,8 @@ pub async fn get_data_source_handler(
// Get credentials from the vault
let secret = read_secret(&data_source.id).await?;
let credentials: Value = serde_json::from_str(&secret)
.map_err(|e| anyhow!("Failed to parse credentials: {}", e))?;
let credentials: Credential =
serde_json::from_str(&secret).map_err(|e| anyhow!("Failed to parse credentials: {}", e))?;
// Convert datasets to response format
let datasets_response: Vec<DatasetResponse> = datasets_list
@ -103,4 +104,4 @@ pub async fn get_data_source_handler(
};
Ok(response)
}
}