Skip to content

Commit

Permalink
Fix like and bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhekim committed Nov 25, 2024
1 parent ff98179 commit f0c4ba7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.group7.demo.dtos;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -24,4 +25,14 @@ public class PostResponse {
private boolean isLiked;
private boolean isBookmarked;
private String imageUrl;

@JsonProperty("isLiked") // Explicitly specify the field name for JSON serialization
public boolean getIsLiked() {
return isLiked;
}

@JsonProperty("isLiked") // Explicitly specify the field name for JSON serialization
public boolean getIsBookmarked() {
return isBookmarked;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import java.util.HashSet;
import java.util.Set;

@Data

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Getter
@Setter
@EqualsAndHashCode(exclude = {"tags", "likedByUsers", "bookmarkedByUsers"}) // Avoid using tags in equals and hashCode to prevent recursion
public class Post {

Expand Down

0 comments on commit f0c4ba7

Please sign in to comment.