Merge branch 'dallin/bus-889-align-cli-tooling-with-the-in-app-editor' into big-nate/bus-891-reorganize-and-redo-permissions-tabs

This commit is contained in:
Nate Kelley 2025-01-10 10:33:59 -07:00
commit adc0e4e57e
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 31 additions and 2 deletions

View File

@ -36,6 +36,9 @@ pub struct GetDatasetResponse {
pub name: String, pub name: String,
pub sql: Option<String>, pub sql: Option<String>,
pub yml_file: Option<String>, pub yml_file: Option<String>,
pub data_source_name: String,
pub data_source_type: String,
pub data_source_id: Uuid,
} }
pub async fn get_dataset( pub async fn get_dataset(
@ -88,7 +91,18 @@ async fn get_dataset_handler(dataset_id: &Uuid, user: &User) -> Result<GetDatase
)); ));
} }
let (dataset_id, name, sql, when_to_use, yml_file) = match datasets::table // TODO: DATASOURCE INFO, name, type, id, etc.
let (
dataset_id,
name,
sql,
when_to_use,
yml_file,
data_source_name,
data_source_type,
data_source_id,
) = match datasets::table
.inner_join(data_sources::table.on(datasets::data_source_id.eq(data_sources::id)))
.filter(datasets::id.eq(dataset_id)) .filter(datasets::id.eq(dataset_id))
.filter(datasets::deleted_at.is_null()) .filter(datasets::deleted_at.is_null())
.select(( .select((
@ -97,8 +111,20 @@ async fn get_dataset_handler(dataset_id: &Uuid, user: &User) -> Result<GetDatase
datasets::definition, datasets::definition,
datasets::when_to_use, datasets::when_to_use,
datasets::yml_file, datasets::yml_file,
data_sources::name,
data_sources::type_,
data_sources::id,
)) ))
.first::<(Uuid, String, String, Option<String>, Option<String>)>(&mut conn) .first::<(
Uuid,
String,
String,
Option<String>,
Option<String>,
String,
String,
Uuid,
)>(&mut conn)
.await .await
{ {
Ok(result) => result, Ok(result) => result,
@ -111,5 +137,8 @@ async fn get_dataset_handler(dataset_id: &Uuid, user: &User) -> Result<GetDatase
sql: Some(sql), sql: Some(sql),
when_to_use, when_to_use,
yml_file, yml_file,
data_source_name,
data_source_type,
data_source_id,
}) })
} }