-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from oduck-team/feature/140
주간 인기 애니 조회 #140
- Loading branch information
Showing
18 changed files
with
395 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/io/oduck/api/domain/genre/repository/GenreRepositoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
package io.oduck.api.domain.genre.repository; | ||
|
||
import io.oduck.api.domain.genre.entity.Genre; | ||
import java.util.List; | ||
|
||
public interface GenreRepositoryCustom { | ||
|
||
List<Genre> findAllByAnimeId(Long animeId); | ||
boolean existsByName(String name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/io/oduck/api/domain/weekly/dto/WeeklyDsl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.oduck.api.domain.weekly.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
public class WeeklyDsl { | ||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class WeeklyAnimeDsl { | ||
private Long animeId; | ||
private String title; | ||
private String thumbnail; | ||
private Long scoreTotal; | ||
private Long scoreCount; | ||
private Double rankScore; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/io/oduck/api/domain/weekly/dto/WeeklyRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.oduck.api.domain.weekly.dto; | ||
|
||
import io.oduck.api.domain.weekly.dto.WeeklyDsl.WeeklyAnimeDsl; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
public class WeeklyRes { | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class WeeklyAnimeRes { | ||
private Long animeId; | ||
private String title; | ||
private String thumbnail; | ||
private List<String> genres; | ||
private Double avgScore; | ||
private Double rankScore; | ||
|
||
public static WeeklyAnimeRes of(WeeklyAnimeDsl weeklyAnimeDsl) { | ||
|
||
Double avgScore = weeklyAnimeDsl.getScoreCount() == 0 ? 0 : Double.valueOf(weeklyAnimeDsl.getScoreTotal()) / weeklyAnimeDsl.getScoreCount(); | ||
return WeeklyAnimeRes.builder() | ||
.animeId(weeklyAnimeDsl.getAnimeId()) | ||
.title(weeklyAnimeDsl.getTitle()) | ||
.thumbnail(weeklyAnimeDsl.getThumbnail()) | ||
.avgScore(avgScore) | ||
.rankScore(weeklyAnimeDsl.getRankScore()) | ||
.build(); | ||
} | ||
|
||
public WeeklyAnimeRes withGenres(List<String> genres) { | ||
this.genres = genres; | ||
return this; | ||
} | ||
} | ||
} |
Oops, something went wrong.