diff --git a/.sqlx/query-16208887bc2f2ca6b5f3df8062a12b482908f9f113c0474eeae75f6784b5e0fc.json b/.sqlx/query-16208887bc2f2ca6b5f3df8062a12b482908f9f113c0474eeae75f6784b5e0fc.json new file mode 100644 index 00000000..218c26e8 --- /dev/null +++ b/.sqlx/query-16208887bc2f2ca6b5f3df8062a12b482908f9f113c0474eeae75f6784b5e0fc.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO af_published_view_reaction (comment_id, view_id, created_by, reaction_type)\n VALUES ($1, $2, (SELECT uid FROM af_user WHERE uuid = $3), $4)\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Text" + ] + }, + "nullable": [] + }, + "hash": "16208887bc2f2ca6b5f3df8062a12b482908f9f113c0474eeae75f6784b5e0fc" +} diff --git a/.sqlx/query-304da1f7fec4fcd69c2e0e0bbb24edb0bce2e988c6fea1eb856b7625b4d1f16f.json b/.sqlx/query-304da1f7fec4fcd69c2e0e0bbb24edb0bce2e988c6fea1eb856b7625b4d1f16f.json new file mode 100644 index 00000000..df054795 --- /dev/null +++ b/.sqlx/query-304da1f7fec4fcd69c2e0e0bbb24edb0bce2e988c6fea1eb856b7625b4d1f16f.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n avr.comment_id,\n avr.reaction_type,\n au.uuid AS user_uuid,\n au.name AS user_name\n FROM af_published_view_reaction avr\n INNER JOIN af_user au ON avr.created_by = au.uid\n WHERE view_id = $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "comment_id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "reaction_type", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "user_uuid", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "user_name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "304da1f7fec4fcd69c2e0e0bbb24edb0bce2e988c6fea1eb856b7625b4d1f16f" +} diff --git a/.sqlx/query-3bf9811b3cfc16b677c76acee21342b892cf815954e4516589493aae01555dc0.json b/.sqlx/query-3bf9811b3cfc16b677c76acee21342b892cf815954e4516589493aae01555dc0.json new file mode 100644 index 00000000..76dfc942 --- /dev/null +++ b/.sqlx/query-3bf9811b3cfc16b677c76acee21342b892cf815954e4516589493aae01555dc0.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "\n DELETE FROM af_published_view_reaction\n WHERE view_id = $1 AND created_by = (SELECT uid FROM af_user WHERE uuid = $2) AND reaction_type = $3\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Text" + ] + }, + "nullable": [] + }, + "hash": "3bf9811b3cfc16b677c76acee21342b892cf815954e4516589493aae01555dc0" +} diff --git a/.sqlx/query-f9a80c40a2dea06b391a065c946472ff8e1a8e63425155e88b472b91c1e24f3a.json b/.sqlx/query-f9a80c40a2dea06b391a065c946472ff8e1a8e63425155e88b472b91c1e24f3a.json new file mode 100644 index 00000000..83d4156f --- /dev/null +++ b/.sqlx/query-f9a80c40a2dea06b391a065c946472ff8e1a8e63425155e88b472b91c1e24f3a.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n avr.comment_id,\n avr.reaction_type,\n au.uuid AS user_uuid,\n au.name AS user_name\n FROM af_published_view_reaction avr\n INNER JOIN af_user au ON avr.created_by = au.uid\n WHERE comment_id = $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "comment_id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "reaction_type", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "user_uuid", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "user_name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "f9a80c40a2dea06b391a065c946472ff8e1a8e63425155e88b472b91c1e24f3a" +} diff --git a/libs/client-api/src/http_publish.rs b/libs/client-api/src/http_publish.rs index ded39be7..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, DeleteGlobalCommentParams, GlobalComments, PublishInfo, - UpdatePublishNamespace, + CreateGlobalCommentParams, CreateReactionParams, DeleteGlobalCommentParams, DeleteReactionParams, + GetReactionQueryParams, GlobalComments, PublishInfo, Reactions, UpdatePublishNamespace, }; use reqwest::Method; use shared_entity::response::{AppResponse, AppResponseError}; @@ -107,6 +107,50 @@ impl Client { .await?; AppResponse::<()>::from_response(resp).await?.into_error() } + + pub async fn create_reaction_on_comment( + &self, + reaction_type: &str, + comment_id: &uuid::Uuid, + view_id: &uuid::Uuid, + ) -> Result<(), AppResponseError> { + let url = format!( + "{}/api/workspace/published-info/{}/reaction", + self.base_url, view_id + ); + let resp = self + .http_client_with_auth(Method::POST, &url) + .await? + .json(&CreateReactionParams { + reaction_type: reaction_type.to_string(), + comment_id: *comment_id, + }) + .send() + .await?; + AppResponse::<()>::from_response(resp).await?.into_error() + } + + pub async fn delete_reaction_on_comment( + &self, + reaction_type: &str, + view_id: &uuid::Uuid, + comment_id: &uuid::Uuid, + ) -> Result<(), AppResponseError> { + let url = format!( + "{}/api/workspace/published-info/{}/reaction", + self.base_url, view_id + ); + let resp = self + .http_client_with_auth(Method::DELETE, &url) + .await? + .json(&DeleteReactionParams { + reaction_type: reaction_type.to_string(), + comment_id: *comment_id, + }) + .send() + .await?; + AppResponse::<()>::from_response(resp).await?.into_error() + } } // Guest API (no login required) @@ -205,4 +249,26 @@ impl Client { .await? .into_data() } + + pub async fn get_published_view_reactions( + &self, + view_id: &uuid::Uuid, + comment_id: &Option, + ) -> Result { + let url = format!( + "{}/api/workspace/published-info/{}/reaction", + self.base_url, view_id + ); + 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 8896657d..ea6e40cd 100644 --- a/libs/database-entity/src/dto.rs +++ b/libs/database-entity/src/dto.rs @@ -849,7 +849,7 @@ pub struct GlobalComments { pub comments: Vec, } -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize, Debug, Clone)] pub struct AFWebUser { pub uid: Uuid, pub name: String, @@ -878,6 +878,35 @@ pub struct DeleteGlobalCommentParams { pub comment_id: Uuid, } +#[derive(Serialize, Deserialize, Debug)] +pub struct Reactions { + pub reactions: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Reaction { + pub reaction_type: String, + pub react_users: Vec, + 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, + pub comment_id: Uuid, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct DeleteReactionParams { + pub reaction_type: String, + pub comment_id: Uuid, +} + /// Indexing status of a document. #[derive(Debug, Clone, Copy, Eq, PartialEq)] pub enum IndexingStatus { diff --git a/libs/database/src/workspace.rs b/libs/database/src/workspace.rs index cde624aa..477c7c32 100644 --- a/libs/database/src/workspace.rs +++ b/libs/database/src/workspace.rs @@ -1,6 +1,6 @@ use database_entity::dto::{ AFRole, AFWebUser, AFWorkspaceInvitation, AFWorkspaceInvitationStatus, AFWorkspaceSettings, - GlobalComment, PublishCollabItem, PublishInfo, + GlobalComment, PublishCollabItem, PublishInfo, Reaction, }; use futures_util::stream::BoxStream; use sqlx::{types::uuid, Executor, PgPool, Postgres, Transaction}; @@ -1227,3 +1227,164 @@ pub async fn update_comment_deletion_status<'a, E: Executor<'a, Database = Postg Ok(()) } + +#[derive(PartialEq, Eq, Hash)] +struct ReactionKey { + comment_id: Uuid, + reaction_type: String, +} + +pub async fn select_reactions_for_published_view<'a, E: Executor<'a, Database = Postgres>>( + executor: E, + view_id: &Uuid, +) -> Result, AppError> { + let rows = sqlx::query!( + r#" + SELECT + avr.comment_id, + avr.reaction_type, + au.uuid AS user_uuid, + au.name AS user_name + FROM af_published_view_reaction avr + INNER JOIN af_user au ON avr.created_by = au.uid + WHERE view_id = $1 + "#, + view_id, + ) + .fetch_all(executor) + .await?; + let reaction_to_users_map: HashMap> = rows.iter().fold( + HashMap::new(), + |mut acc: HashMap>, row| { + let users = acc + .entry(ReactionKey { + comment_id: row.comment_id, + reaction_type: row.reaction_type.clone(), + }) + .or_default(); + users.push(AFWebUser { + uid: row.user_uuid, + name: row.user_name.clone(), + avatar_url: None, + }); + acc + }, + ); + let reactions = reaction_to_users_map + .iter() + .map( + |( + ReactionKey { + comment_id, + reaction_type, + }, + users, + )| Reaction { + comment_id: *comment_id, + reaction_type: reaction_type.clone(), + react_users: users.clone(), + }, + ) + .collect(); + + Ok(reactions) +} + +pub async fn select_reactions_for_comment<'a, E: Executor<'a, Database = Postgres>>( + executor: E, + comment_id: &Uuid, +) -> Result, AppError> { + let rows = sqlx::query!( + r#" + SELECT + avr.comment_id, + avr.reaction_type, + au.uuid AS user_uuid, + au.name AS user_name + FROM af_published_view_reaction avr + INNER JOIN af_user au ON avr.created_by = au.uid + WHERE comment_id = $1 + "#, + comment_id, + ) + .fetch_all(executor) + .await?; + let reaction_type_to_users_map: HashMap> = rows.iter().fold( + HashMap::new(), + |mut acc: HashMap>, row| { + let users = acc.entry(row.reaction_type.clone()).or_default(); + users.push(AFWebUser { + uid: row.user_uuid, + name: row.user_name.clone(), + avatar_url: None, + }); + acc + }, + ); + let reactions = reaction_type_to_users_map + .iter() + .map(|(reaction_type, users)| Reaction { + reaction_type: reaction_type.clone(), + react_users: users.clone(), + comment_id: *comment_id, + }) + .collect(); + + Ok(reactions) +} + +pub async fn insert_reaction_on_comment<'a, E: Executor<'a, Database = Postgres>>( + executor: E, + comment_id: &Uuid, + view_id: &Uuid, + user_uuid: &Uuid, + reaction_type: &str, +) -> Result<(), AppError> { + let res = sqlx::query!( + r#" + INSERT INTO af_published_view_reaction (comment_id, view_id, created_by, reaction_type) + VALUES ($1, $2, (SELECT uid FROM af_user WHERE uuid = $3), $4) + "#, + comment_id, + view_id, + user_uuid, + reaction_type, + ) + .execute(executor) + .await?; + + if res.rows_affected() != 1 { + tracing::error!( + "Failed to insert reaction to comment, comment_id: {}, user_id: {}, reaction_type: {}, rows_affected: {}", + comment_id, user_uuid, reaction_type, res.rows_affected() + ); + }; + + Ok(()) +} + +pub async fn delete_reaction_from_comment<'a, E: Executor<'a, Database = Postgres>>( + executor: E, + view_id: &Uuid, + user_uuid: &Uuid, + reaction_type: &str, +) -> Result<(), AppError> { + let res = sqlx::query!( + r#" + DELETE FROM af_published_view_reaction + WHERE view_id = $1 AND created_by = (SELECT uid FROM af_user WHERE uuid = $2) AND reaction_type = $3 + "#, + view_id, + user_uuid, + reaction_type, + ).execute(executor).await?; + + if res.rows_affected() != 1 { + tracing::error!( + "Failed to delete reaction from published view, view_id: {}, user_id: {}, reaction_type: {}, rows_affected: {}", + view_id, user_uuid, reaction_type, res.rows_affected() + ); + }; + + Ok(()) +} diff --git a/migrations/20240725065111_publish_view_reaction.sql b/migrations/20240725065111_publish_view_reaction.sql new file mode 100644 index 00000000..60ff2c14 --- /dev/null +++ b/migrations/20240725065111_publish_view_reaction.sql @@ -0,0 +1,9 @@ +-- stores the reactions on a published view +CREATE TABLE IF NOT EXISTS af_published_view_reaction ( + comment_id UUID NOT NULL REFERENCES af_published_view_comment(comment_id) ON DELETE CASCADE, + reaction_type TEXT NOT NULL, + created_by BIGINT NOT NULL REFERENCES af_user(uid) ON DELETE CASCADE, + view_id UUID NOT NULL, + PRIMARY KEY (comment_id, reaction_type, created_by) +); +CREATE INDEX IF NOT EXISTS idx_view_id_on_af_published_view_reaction ON af_published_view_reaction(view_id); diff --git a/src/api/workspace.rs b/src/api/workspace.rs index 1513fff4..829f13d2 100644 --- a/src/api/workspace.rs +++ b/src/api/workspace.rs @@ -1,7 +1,7 @@ use crate::api::util::PayloadReader; use crate::biz::workspace::ops::{ - create_comment_on_published_view, get_comments_on_published_view, - remove_comment_on_published_view, + create_comment_on_published_view, create_reaction_on_comment, get_comments_on_published_view, + get_reactions_on_published_view, remove_comment_on_published_view, remove_reaction_on_comment, }; use actix_web::web::{Bytes, Payload}; use actix_web::web::{Data, Json, PayloadConfig}; @@ -153,6 +153,12 @@ pub fn workspace_scope() -> Scope { .route(web::post().to(post_published_collab_comment_handler)) .route(web::delete().to(delete_published_collab_comment_handler)) ) + .service( + web::resource("/published-info/{view_id}/reaction") + .route(web::get().to(get_published_collab_reaction_handler)) + .route(web::post().to(post_published_collab_reaction_handler)) + .route(web::delete().to(delete_published_collab_reaction_handler)) + ) .service( web::resource("/{workspace_id}/publish-namespace") .route(web::put().to(put_publish_namespace_handler)) @@ -1128,6 +1134,51 @@ async fn delete_published_collab_comment_handler( Ok(Json(AppResponse::Ok())) } +async fn get_published_collab_reaction_handler( + view_id: web::Path, + query: web::Query, + state: Data, +) -> Result> { + let view_id = view_id.into_inner(); + let reactions = + get_reactions_on_published_view(&state.pg_pool, &view_id, &query.comment_id).await?; + let resp = Reactions { reactions }; + Ok(Json(AppResponse::Ok().with_data(resp))) +} + +async fn post_published_collab_reaction_handler( + user_uuid: UserUuid, + view_id: web::Path, + data: Json, + state: Data, +) -> Result> { + let view_id = view_id.into_inner(); + create_reaction_on_comment( + &state.pg_pool, + &data.comment_id, + &view_id, + &data.reaction_type, + &user_uuid, + ) + .await?; + Ok(Json(AppResponse::Ok())) +} + +async fn delete_published_collab_reaction_handler( + user_uuid: UserUuid, + data: Json, + state: Data, +) -> Result> { + remove_reaction_on_comment( + &state.pg_pool, + &data.comment_id, + &data.reaction_type, + &user_uuid, + ) + .await?; + Ok(Json(AppResponse::Ok())) +} + async fn post_publish_collabs_handler( workspace_id: web::Path, user_uuid: UserUuid, diff --git a/src/biz/workspace/ops.rs b/src/biz/workspace/ops.rs index 50c7594f..9eb355b9 100644 --- a/src/biz/workspace/ops.rs +++ b/src/biz/workspace/ops.rs @@ -18,24 +18,10 @@ use database::file::s3_client_impl::S3BucketStorage; use database::pg_row::AFWorkspaceMemberRow; use database::user::select_uid_from_email; -use database::workspace::{ - change_workspace_icon, delete_from_workspace, delete_published_collabs, delete_workspace_members, - get_invitation_by_id, insert_comment_to_published_view, insert_or_replace_publish_collab_metas, - insert_user_workspace, insert_workspace_invitation, rename_workspace, select_all_user_workspaces, - select_comments_for_published_view_orderd_by_recency, select_member_count_for_workspaces, - select_publish_collab_meta, select_published_collab_blob, select_published_collab_info, - select_user_is_allowed_to_delete_comment, select_user_is_collab_publisher_for_all_views, - select_user_is_workspace_owner, select_workspace, select_workspace_invitations_for_user, - select_workspace_member, select_workspace_member_list, select_workspace_publish_namespace, - select_workspace_publish_namespace_exists, select_workspace_settings, - select_workspace_total_collab_bytes, update_comment_deletion_status, - update_updated_at_of_workspace, update_workspace_invitation_set_status_accepted, - update_workspace_publish_namespace, upsert_workspace_member, upsert_workspace_member_with_txn, - upsert_workspace_settings, -}; +use database::workspace::*; use database_entity::dto::{ AFAccessLevel, AFRole, AFWorkspace, AFWorkspaceInvitation, AFWorkspaceInvitationStatus, - AFWorkspaceSettings, GlobalComment, WorkspaceUsage, + AFWorkspaceSettings, GlobalComment, Reaction, WorkspaceUsage, }; use gotrue::params::{GenerateLinkParams, GenerateLinkType}; use shared_entity::dto::workspace_dto::{ @@ -206,6 +192,39 @@ pub async fn remove_comment_on_published_view( Ok(()) } +pub async fn get_reactions_on_published_view( + pg_pool: &PgPool, + view_id: &Uuid, + comment_id: &Option, +) -> Result, AppError> { + let reaction = match comment_id { + Some(comment_id) => select_reactions_for_comment(pg_pool, comment_id).await?, + None => select_reactions_for_published_view(pg_pool, view_id).await?, + }; + Ok(reaction) +} + +pub async fn create_reaction_on_comment( + pg_pool: &PgPool, + comment_id: &Uuid, + view_id: &Uuid, + reaction_type: &str, + user_uuid: &Uuid, +) -> Result<(), AppError> { + insert_reaction_on_comment(pg_pool, comment_id, view_id, user_uuid, reaction_type).await?; + Ok(()) +} + +pub async fn remove_reaction_on_comment( + pg_pool: &PgPool, + comment_id: &Uuid, + reaction_type: &str, + user_uuid: &Uuid, +) -> Result<(), AppError> { + delete_reaction_from_comment(pg_pool, comment_id, user_uuid, reaction_type).await?; + Ok(()) +} + pub async fn delete_published_workspace_collab( pg_pool: &PgPool, workspace_id: &Uuid, diff --git a/tests/workspace/publish.rs b/tests/workspace/publish.rs index 383e48f5..6f714de6 100644 --- a/tests/workspace/publish.rs +++ b/tests/workspace/publish.rs @@ -1,3 +1,4 @@ +use std::collections::HashMap; use std::thread::sleep; use std::time::Duration; @@ -402,6 +403,128 @@ async fn test_publish_comments() { assert!(published_view_comments.iter().all(|c| c.is_deleted)); } +#[tokio::test] +async fn test_publish_reactions() { + let (page_owner_client, _) = generate_unique_registered_user_client().await; + let workspace_id = get_first_workspace_string(&page_owner_client).await; + let published_view_namespace = uuid::Uuid::new_v4().to_string(); + page_owner_client + .set_workspace_publish_namespace(&workspace_id.to_string(), &published_view_namespace) + .await + .unwrap(); + + let publish_name = "published-view"; + let view_id = uuid::Uuid::new_v4(); + page_owner_client + .publish_collabs::( + &workspace_id, + vec![PublishCollabItem { + meta: PublishCollabMetadata { + view_id, + publish_name: publish_name.to_string(), + metadata: MyCustomMetadata { + title: "some_title".to_string(), + }, + }, + data: "yrs_encoded_data_1".as_bytes(), + }], + ) + .await + .unwrap(); + page_owner_client + .create_comment_on_published_view(&view_id, "likable comment", &None) + .await + .unwrap(); + // This is to ensure that the second comment creation timestamp is later than the first one + sleep(Duration::from_millis(1)); + page_owner_client + .create_comment_on_published_view(&view_id, "party comment", &None) + .await + .unwrap(); + let mut comments = page_owner_client + .get_published_view_comments(&view_id) + .await + .unwrap() + .comments; + comments.sort_by_key(|c| c.created_at); + // Test if the reactions are created correctly based on view and comment id + let likable_comment_id = comments[0].comment_id; + let party_comment_id = comments[1].comment_id; + + let like_emoji = "👍"; + let party_emoji = "🎉"; + page_owner_client + .create_reaction_on_comment(like_emoji, &likable_comment_id, &view_id) + .await + .unwrap(); + let guest_client = localhost_client(); + let result = guest_client + .create_reaction_on_comment(like_emoji, &likable_comment_id, &view_id) + .await; + assert!(result.is_err()); + assert_eq!(result.unwrap_err().code, ErrorCode::NotLoggedIn); + + let (user_client, _) = generate_unique_registered_user_client().await; + user_client + .create_reaction_on_comment(like_emoji, &likable_comment_id, &view_id) + .await + .unwrap(); + user_client + .create_reaction_on_comment(party_emoji, &party_comment_id, &view_id) + .await + .unwrap(); + + let reactions = guest_client + .get_published_view_reactions(&view_id, &None) + .await + .unwrap() + .reactions; + let reaction_count: HashMap = reactions + .iter() + .map(|r| (r.reaction_type.clone(), r.react_users.len() as i32)) + .collect(); + assert_eq!(reaction_count.len(), 2); + assert_eq!(*reaction_count.get(like_emoji).unwrap(), 2); + assert_eq!(*reaction_count.get(party_emoji).unwrap(), 1); + + // Test if the reactions are deleted correctly based on view and comment id + let result = guest_client + .delete_reaction_on_comment(like_emoji, &likable_comment_id, &view_id) + .await; + assert!(result.is_err()); + assert_eq!(result.unwrap_err().code, ErrorCode::NotLoggedIn); + user_client + .delete_reaction_on_comment(like_emoji, &likable_comment_id, &view_id) + .await + .unwrap(); + + let reactions = guest_client + .get_published_view_reactions(&view_id, &None) + .await + .unwrap() + .reactions; + let reaction_count: HashMap = reactions + .iter() + .map(|r| (r.reaction_type.clone(), r.react_users.len() as i32)) + .collect(); + assert_eq!(reaction_count.len(), 2); + assert_eq!(*reaction_count.get(like_emoji).unwrap(), 1); + assert_eq!(*reaction_count.get(party_emoji).unwrap(), 1); + + // Test if we can filter the reactions by comment id + let reactions = guest_client + .get_published_view_reactions(&view_id, &Some(likable_comment_id)) + .await + .unwrap() + .reactions; + let reaction_count: HashMap = reactions + .iter() + .map(|r| (r.reaction_type.clone(), r.react_users.len() as i32)) + .collect(); + assert_eq!(reaction_count.len(), 1); + assert_eq!(*reaction_count.get(like_emoji).unwrap(), 1); +} + #[tokio::test] async fn test_publish_load_test() { let (c, _user) = generate_unique_registered_user_client().await;