chore: use struct instead of tuple struct for GlobalComments
This commit is contained in:
parent
f71ac07ae7
commit
69a6ac48c8
|
|
@ -847,7 +847,9 @@ pub struct PublishCollabItem<Meta, Data> {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct GlobalComments(pub Vec<GlobalComment>);
|
||||
pub struct GlobalComments {
|
||||
pub comments: Vec<GlobalComment>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct AFWebUser {
|
||||
|
|
|
|||
|
|
@ -1103,7 +1103,7 @@ async fn get_published_collab_comment_handler(
|
|||
) -> Result<JsonAppResponse<GlobalComments>> {
|
||||
let view_id = view_id.into_inner();
|
||||
let comments = get_comments_on_published_view(&state.pg_pool, &view_id).await?;
|
||||
let resp = GlobalComments(comments);
|
||||
let resp = GlobalComments { comments };
|
||||
Ok(Json(AppResponse::Ok().with_data(resp)))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,19 +271,19 @@ async fn test_publish_comments() {
|
|||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
assert_eq!(published_view_comments.len(), 2);
|
||||
let published_view_comments: Vec<GlobalComment> = first_user_client
|
||||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
assert_eq!(published_view_comments.len(), 2);
|
||||
let mut published_view_comments: Vec<GlobalComment> = guest_client
|
||||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
assert_eq!(published_view_comments.len(), 2);
|
||||
assert!(published_view_comments.iter().all(|c| !c.is_deleted));
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ async fn test_publish_comments() {
|
|||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
published_view_comments.sort_by_key(|c| c.created_at);
|
||||
let comment_creators = published_view_comments
|
||||
.iter()
|
||||
|
|
@ -374,7 +374,7 @@ async fn test_publish_comments() {
|
|||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
published_view_comments.sort_by_key(|c| c.created_at);
|
||||
assert_eq!(
|
||||
published_view_comments
|
||||
|
|
@ -400,7 +400,7 @@ async fn test_publish_comments() {
|
|||
.get_published_view_comments(&view_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.0;
|
||||
.comments;
|
||||
assert_eq!(published_view_comments.len(), 3);
|
||||
assert!(published_view_comments.iter().all(|c| c.is_deleted));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue