fix: get workspace namespace
This commit is contained in:
parent
de0b03d6ec
commit
236a22ac97
|
|
@ -29,6 +29,25 @@ impl Client {
|
|||
AppResponse::<()>::from_response(resp).await?.into_error()
|
||||
}
|
||||
|
||||
pub async fn get_workspace_publish_namespace(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
) -> Result<String, AppResponseError> {
|
||||
let url = format!(
|
||||
"{}/api/workspace/{}/publish-namespace",
|
||||
self.base_url, workspace_id
|
||||
);
|
||||
let resp = self
|
||||
.http_client_with_auth(Method::GET, &url)
|
||||
.await?
|
||||
.get(&url)
|
||||
.send()
|
||||
.await?;
|
||||
AppResponse::<String>::from_response(resp)
|
||||
.await?
|
||||
.into_data()
|
||||
}
|
||||
|
||||
pub async fn publish_collab<T>(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
|
|
@ -95,20 +114,6 @@ impl Client {
|
|||
|
||||
// Guest API (no login required)
|
||||
impl Client {
|
||||
pub async fn get_workspace_publish_namespace(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
) -> Result<String, AppResponseError> {
|
||||
let url = format!(
|
||||
"{}/api/workspace/{}/publish-namespace",
|
||||
self.base_url, workspace_id
|
||||
);
|
||||
let resp = self.cloud_client.get(&url).send().await?;
|
||||
AppResponse::<String>::from_response(resp)
|
||||
.await?
|
||||
.into_data()
|
||||
}
|
||||
|
||||
pub async fn get_published_collab<T>(
|
||||
&self,
|
||||
publish_namespace: &str,
|
||||
|
|
|
|||
|
|
@ -959,7 +959,7 @@ async fn get_publish_namespace_handler(
|
|||
) -> Result<Json<AppResponse<String>>> {
|
||||
let workspace_id = workspace_id.into_inner();
|
||||
let namespace =
|
||||
biz::workspace::ops::get_workspace_namespace(&state.pg_pool, &workspace_id).await?;
|
||||
biz::workspace::ops::get_workspace_publish_namespace(&state.pg_pool, &workspace_id).await?;
|
||||
Ok(Json(AppResponse::Ok().with_data(namespace)))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ pub async fn set_workspace_namespace(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_workspace_namespace(
|
||||
pub async fn get_workspace_publish_namespace(
|
||||
pg_pool: &PgPool,
|
||||
workspace_id: &Uuid,
|
||||
) -> Result<String, AppError> {
|
||||
|
|
|
|||
|
|
@ -12,13 +12,7 @@ async fn test_set_publish_namespace_set() {
|
|||
.await
|
||||
.err()
|
||||
.unwrap();
|
||||
|
||||
if format!("{:?}", err.code) != "PublishNamespaceNotSet" {
|
||||
panic!(
|
||||
"Expected PublishNamespaceNotSet, got: code {:?}, message {:?}",
|
||||
err.code, err.message
|
||||
);
|
||||
}
|
||||
assert_eq!(format!("{:?}", err.code), "PublishNamespaceNotSet");
|
||||
}
|
||||
|
||||
let namespace = uuid::Uuid::new_v4().to_string();
|
||||
|
|
|
|||
Loading…
Reference in New Issue