Ignore:
Timestamp:
02/07/22 21:26:03 (3 years ago)
Author:
GitHub <noreply@…>
Branches:
main
Children:
0226942
Parents:
7f36551 (diff), 3c0f9a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Mato-77 <56981531+Mato-77@…> (02/07/22 21:26:03)
git-committer:
GitHub <noreply@…> (02/07/22 21:26:03)
Message:

Merge pull request #2 from partaloski/master

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 rad4243e  
    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.