|
|
@ -26,6 +26,7 @@ pub fn routes() -> Vec<Route> {
|
|
|
|
leave_organization,
|
|
|
|
leave_organization,
|
|
|
|
get_user_collections,
|
|
|
|
get_user_collections,
|
|
|
|
get_org_collections,
|
|
|
|
get_org_collections,
|
|
|
|
|
|
|
|
get_org_collections_details,
|
|
|
|
get_org_collection_detail,
|
|
|
|
get_org_collection_detail,
|
|
|
|
get_collection_users,
|
|
|
|
get_collection_users,
|
|
|
|
put_collection_users,
|
|
|
|
put_collection_users,
|
|
|
@ -309,6 +310,32 @@ async fn get_org_collections(org_id: String, _headers: ManagerHeadersLoose, mut
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[get("/organizations/<org_id>/collections/details")]
|
|
|
|
|
|
|
|
async fn get_org_collections_details(org_id: String, _headers: ManagerHeadersLoose, mut conn: DbConn) -> Json<Value> {
|
|
|
|
|
|
|
|
let mut data = Vec::new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for col in Collection::find_by_organization(&org_id, &mut conn).await {
|
|
|
|
|
|
|
|
let groups: Vec<Value> = CollectionGroup::find_by_collection(&col.uuid, &mut conn)
|
|
|
|
|
|
|
|
.await
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.map(|collection_group| {
|
|
|
|
|
|
|
|
SelectionReadOnly::to_collection_group_details_read_only(collection_group).to_json()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut json_object = col.to_json();
|
|
|
|
|
|
|
|
json_object["Groups"] = json!(groups);
|
|
|
|
|
|
|
|
json_object["Object"] = json!("collectionGroupDetails");
|
|
|
|
|
|
|
|
data.push(json_object)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Json(json!({
|
|
|
|
|
|
|
|
"Data": data,
|
|
|
|
|
|
|
|
"Object": "list",
|
|
|
|
|
|
|
|
"ContinuationToken": null,
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async fn _get_org_collections(org_id: &str, conn: &mut DbConn) -> Value {
|
|
|
|
async fn _get_org_collections(org_id: &str, conn: &mut DbConn) -> Value {
|
|
|
|
Collection::find_by_organization(org_id, conn).await.iter().map(Collection::to_json).collect::<Value>()
|
|
|
|
Collection::find_by_organization(org_id, conn).await.iter().map(Collection::to_json).collect::<Value>()
|
|
|
|
}
|
|
|
|
}
|
|
|
|