88import com .oriole .ocean .common .enumerate .NotifySubscriptionTargetType ;
99import com .oriole .ocean .common .enumerate .NotifyType ;
1010import com .oriole .ocean .common .po .mongo .FavorEntity ;
11- import com .oriole .ocean .common .po .mysql .NoteCommentEntity ;
12- import com .oriole .ocean .common .po .mysql .NoteEntity ;
13- import com .oriole .ocean .common .po .mysql .NoteLikeEntity ;
14- import com .oriole .ocean .common .po .mysql .NotifyEntity ;
11+ import com .oriole .ocean .common .po .mysql .*;
1512import com .oriole .ocean .common .service .*;
1613import com .oriole .ocean .common .vo .AuthUserEntity ;
1714import com .oriole .ocean .common .vo .MsgEntity ;
@@ -204,7 +201,7 @@ public MsgEntity<PageInfo<NoteEntity>> getNoteByTag(
204201 }
205202
206203 // === Like functionality APIs ===
207-
204+
208205 /**
209206 * Like or unlike a note
210207 * @param authUser Authenticated user
@@ -217,7 +214,7 @@ public MsgEntity<NoteLikeEntity> likeNote(
217214 @ AuthUser AuthUserEntity authUser ,
218215 @ RequestParam String noteId ,
219216 @ RequestParam Boolean isLike ) {
220-
217+
221218 String username = authUser .getUsername ();
222219
223220 NoteLikeEntity result = noteService .likeNote (username , noteId , isLike );
@@ -237,7 +234,7 @@ public MsgEntity<String> readNote(
237234
238235 return new MsgEntity <>("SUCCESS" , "1" , "Note read successfully" );
239236 }
240-
237+
241238 /**
242239 * Check if current user has liked a specific note
243240 * @param authUser Authenticated user
@@ -248,10 +245,51 @@ public MsgEntity<String> readNote(
248245 public MsgEntity <Boolean > checkNoteLikeStatus (
249246 @ AuthUser AuthUserEntity authUser ,
250247 @ RequestParam String noteId ) {
251-
248+
252249 String username = authUser .getUsername ();
253250 boolean hasLiked = noteService .hasUserLikedNote (username , noteId );
254-
251+
252+ return new MsgEntity <>("SUCCESS" , "1" , hasLiked );
253+ }
254+
255+ /**
256+ * Like or unlike a comment
257+ * @param authUser Authenticated user
258+ * @param commentId Comment ID to like/unlike
259+ * @param isLike true to like, false to unlike
260+ * @return Success message with like status
261+ */
262+ @ RequestMapping (value = "/likeNoteComment" , method = RequestMethod .POST )
263+ public MsgEntity <NoteCommentLikeEntity > likeNoteComment (
264+ @ AuthUser AuthUserEntity authUser ,
265+ @ RequestParam String commentId ,
266+ @ RequestParam Boolean isLike ) {
267+
268+ String username = authUser .getUsername ();
269+
270+ NoteCommentLikeEntity result = noteCommentService .likeNoteComment (username , commentId , isLike );
271+
272+ if (isLike ) {
273+ return new MsgEntity <>("SUCCESS" , "1" , result );
274+ } else {
275+ return new MsgEntity <>("SUCCESS" , "1" , null );
276+ }
277+ }
278+
279+ /**
280+ * Check if the current user has liked a specific comment
281+ * @param authUser Authenticated user
282+ * @param commentId Comment ID to check
283+ * @return Like status
284+ */
285+ @ RequestMapping (value = "/checkNoteCommentLikeStatus" , method = RequestMethod .POST )
286+ public MsgEntity <Boolean > checkNoteCommentLikeStatus (
287+ @ AuthUser AuthUserEntity authUser ,
288+ @ RequestParam String commentId ) {
289+
290+ String username = authUser .getUsername ();
291+ boolean hasLiked = noteCommentService .hasUserLikedNoteComment (username , commentId );
292+
255293 return new MsgEntity <>("SUCCESS" , "1" , hasLiked );
256294 }
257295
0 commit comments