diff --git a/libs/client-api/src/http_publish.rs b/libs/client-api/src/http_publish.rs index 4d6a457c..423627a3 100644 --- a/libs/client-api/src/http_publish.rs +++ b/libs/client-api/src/http_publish.rs @@ -1,7 +1,7 @@ use bytes::Bytes; use client_api_entity::{ CreateGlobalCommentParams, CreateReactionParams, DeleteGlobalCommentParams, DeleteReactionParams, - GlobalComments, PublishInfo, Reactions, UpdatePublishNamespace, + GetReactionQueryParams, GlobalComments, PublishInfo, Reactions, UpdatePublishNamespace, }; use reqwest::Method; use shared_entity::response::{AppResponse, AppResponseError}; @@ -259,12 +259,14 @@ impl Client { "{}/api/workspace/published-info/{}/reaction", self.base_url, view_id ); - let url = if let Some(comment_id) = comment_id { - format!("{}?comment_id={}", url, comment_id) - } else { - url - }; - let resp = self.cloud_client.get(&url).send().await?; + let resp = self + .cloud_client + .get(url) + .query(&GetReactionQueryParams { + comment_id: *comment_id, + }) + .send() + .await?; AppResponse::::from_response(resp) .await? .into_data() diff --git a/libs/database-entity/src/dto.rs b/libs/database-entity/src/dto.rs index c3f989f2..ea6e40cd 100644 --- a/libs/database-entity/src/dto.rs +++ b/libs/database-entity/src/dto.rs @@ -890,6 +890,11 @@ pub struct Reaction { pub comment_id: Uuid, } +#[derive(Serialize, Deserialize, Debug)] +pub struct GetReactionQueryParams { + pub comment_id: Option, +} + #[derive(Serialize, Deserialize, Debug)] pub struct CreateReactionParams { pub reaction_type: String, diff --git a/libs/database/src/workspace.rs b/libs/database/src/workspace.rs index 6679fd35..477c7c32 100644 --- a/libs/database/src/workspace.rs +++ b/libs/database/src/workspace.rs @@ -1263,7 +1263,7 @@ pub async fn select_reactions_for_published_view<'a, E: Executor<'a, Database = }) .or_default(); users.push(AFWebUser { - uid: row.user_uuid.clone(), + uid: row.user_uuid, name: row.user_name.clone(), avatar_url: None, }); diff --git a/src/api/workspace.rs b/src/api/workspace.rs index d01b1558..829f13d2 100644 --- a/src/api/workspace.rs +++ b/src/api/workspace.rs @@ -13,7 +13,6 @@ use collab::entity::EncodedCollab; use collab_entity::CollabType; use futures_util::future::try_join_all; use prost::Message as ProstMessage; -use serde::Deserialize; use sqlx::types::uuid; use tokio::time::Instant; use tokio_stream::StreamExt; @@ -1135,14 +1134,9 @@ async fn delete_published_collab_comment_handler( Ok(Json(AppResponse::Ok())) } -#[derive(Deserialize)] -struct GetReactionQuery { - comment_id: Option, -} - async fn get_published_collab_reaction_handler( view_id: web::Path, - query: web::Query, + query: web::Query, state: Data, ) -> Result> { let view_id = view_id.into_inner();