@@ -146,7 +146,18 @@ pub async fn list_comments(
146146 )
147147 } ) ?;
148148
149- Ok ( Json ( comments) )
149+ let response_comments: Vec < Comment > = comments. into_iter ( ) . map ( |c| Comment {
150+ id : c. id ,
151+ tutorial_id : c. tutorial_id ,
152+ post_id : c. post_id ,
153+ author : c. author ,
154+ content : c. content ,
155+ created_at : c. created_at ,
156+ votes : c. votes ,
157+ is_admin : c. is_admin ,
158+ } ) . collect ( ) ;
159+
160+ Ok ( Json ( response_comments) )
150161}
151162
152163pub async fn create_comment (
@@ -202,7 +213,18 @@ pub async fn list_post_comments(
202213 ( StatusCode :: INTERNAL_SERVER_ERROR , Json ( ErrorResponse { error : "Failed to fetch comments" . to_string ( ) } ) )
203214 } ) ?;
204215
205- Ok ( Json ( comments) )
216+ let response_comments: Vec < Comment > = comments. into_iter ( ) . map ( |c| Comment {
217+ id : c. id ,
218+ tutorial_id : c. tutorial_id ,
219+ post_id : c. post_id ,
220+ author : c. author ,
221+ content : c. content ,
222+ created_at : c. created_at ,
223+ votes : c. votes ,
224+ is_admin : c. is_admin ,
225+ } ) . collect ( ) ;
226+
227+ Ok ( Json ( response_comments) )
206228}
207229
208230pub async fn create_post_comment (
@@ -301,7 +323,18 @@ async fn create_comment_internal(
301323 ( StatusCode :: INTERNAL_SERVER_ERROR , Json ( ErrorResponse { error : "Failed to create comment" . to_string ( ) } ) )
302324 } ) ?;
303325
304- Ok ( Json ( comment) )
326+ let response_comment = Comment {
327+ id : comment. id ,
328+ tutorial_id : comment. tutorial_id ,
329+ post_id : comment. post_id ,
330+ author : comment. author ,
331+ content : comment. content ,
332+ created_at : comment. created_at ,
333+ votes : comment. votes ,
334+ is_admin : comment. is_admin ,
335+ } ;
336+
337+ Ok ( Json ( response_comment) )
305338}
306339
307340pub async fn delete_comment (
0 commit comments