mirror of https://github.com/buster-so/buster.git
Add organizations module and integrate with user routes
This commit is contained in:
parent
d74214a910
commit
f628b38e85
|
@ -3,6 +3,7 @@ mod assets;
|
||||||
mod data_sources;
|
mod data_sources;
|
||||||
mod dataset_groups;
|
mod dataset_groups;
|
||||||
mod datasets;
|
mod datasets;
|
||||||
|
mod organizations;
|
||||||
mod permission_groups;
|
mod permission_groups;
|
||||||
mod sql;
|
mod sql;
|
||||||
mod users;
|
mod users;
|
||||||
|
@ -21,6 +22,7 @@ pub fn router() -> Router {
|
||||||
.nest("/permission_groups", permission_groups::router())
|
.nest("/permission_groups", permission_groups::router())
|
||||||
.nest("/dataset_groups", dataset_groups::router())
|
.nest("/dataset_groups", dataset_groups::router())
|
||||||
.nest("/sql", sql::router())
|
.nest("/sql", sql::router())
|
||||||
|
.nest("/organizations", organizations::router())
|
||||||
.route_layer(middleware::from_fn(auth)),
|
.route_layer(middleware::from_fn(auth)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use axum::{extract::Path, Extension, http::StatusCode};
|
use axum::{extract::Path, http::StatusCode, Extension};
|
||||||
use diesel::{ExpressionMethods, QueryDsl, JoinOnDsl};
|
use diesel::{ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -58,7 +58,13 @@ async fn list_organization_users_handler(organization_id: Uuid) -> Result<Vec<Us
|
||||||
))
|
))
|
||||||
.filter(users_to_organizations::organization_id.eq(organization_id))
|
.filter(users_to_organizations::organization_id.eq(organization_id))
|
||||||
.filter(users_to_organizations::deleted_at.is_null())
|
.filter(users_to_organizations::deleted_at.is_null())
|
||||||
.load::<(Uuid, String, Option<String>, UserOrganizationRole, UserOrganizationStatus)>(&mut conn)
|
.load::<(
|
||||||
|
Uuid,
|
||||||
|
String,
|
||||||
|
Option<String>,
|
||||||
|
UserOrganizationRole,
|
||||||
|
UserOrganizationStatus,
|
||||||
|
)>(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(users
|
Ok(users
|
||||||
|
|
Loading…
Reference in New Issue