Ignore:
Timestamp:
02/07/22 19:57:58 (3 years ago)
Author:
Petar Partaloski <ppartaloski@…>
Branches:
main
Children:
ad4243e, c02189f
Parents:
7f36551
Message:

Added genre liking, fixed counter, improved paging, improved searches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java

    r7f36551 r3c0f9a9  
    33import lombok.Data;
    44
     5import javax.persistence.Entity;
     6import javax.persistence.Table;
     7import java.util.Comparator;
     8import java.util.Objects;
     9
    510@Data
    611public class GenreLikes {
    7 
     12    private Integer genreId;
    813    private String name;
    914    private Long likes;
    1015
    11     public GenreLikes(String name, Long likes) {
     16    public static Comparator<GenreLikes> sorter = Comparator.comparing(GenreLikes::getLikes).thenComparing(GenreLikes::getName).reversed();
     17
     18    public GenreLikes(Integer genreId, String name, Long likes) {
     19        this.genreId = genreId;
    1220        this.name = name;
    1321        this.likes = likes;
     22
     23    }
     24
     25    @Override
     26    public boolean equals(Object o) {
     27        if (this == o) return true;
     28        if (o == null || getClass() != o.getClass()) return false;
     29        GenreLikes that = (GenreLikes) o;
     30        return Objects.equals(genreId, that.genreId);
     31    }
     32
     33    @Override
     34    public int hashCode() {
     35        return Objects.hash(genreId);
    1436    }
    1537}
Note: See TracChangeset for help on using the changeset viewer.