diff --git a/server/src/routes/comment.rs b/server/src/routes/comment.rs index dcb1afe..e7098f1 100644 --- a/server/src/routes/comment.rs +++ b/server/src/routes/comment.rs @@ -42,7 +42,6 @@ pub async fn new_comment( } let claims = user_claims.unwrap(); - info!("User {:?} created a new comment", &claims.sub); let content = data.content.clone(); let username = claims.sub.clone(); @@ -54,6 +53,13 @@ pub async fn new_comment( .unwrap() .id; + info!( + "User {:?}, with id {:?} is creating a new comment", + &claims.sub, userid + ); + + info!("Creating a new comment {:?}", &data); + let success = db_new_comment( &state.pool, data.parent_post_id, @@ -64,7 +70,13 @@ pub async fn new_comment( .await; match success { - true => Ok(HttpResponse::Ok().json("Success")), - false => Ok(HttpResponse::BadRequest().json("Error")), + true => { + info!("User {:?} created a new comment", &claims.sub); + Ok(HttpResponse::Ok().json("Successfully created comment")) + } + false => { + info!("User {:?} failed to create a new comment", &claims.sub); + Ok(HttpResponse::BadRequest().json("Failed to create comment")) + } } }