-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related:#58
- Loading branch information
Showing
5 changed files
with
61 additions
and
63 deletions.
There are no files selected for viewing
92 changes: 48 additions & 44 deletions
92
application/src/main/java/core/application/movies/models/entities/CachedMovieEntity.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,54 +1,58 @@ | ||
package core.application.movies.models.entities; | ||
|
||
import core.application.movies.constant.Genre; | ||
import lombok.*; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@ToString | ||
public class CachedMovieEntity { | ||
/** | ||
* {@code 알파벳}-{@code 숫자} 형태 {@code (KMDB 영화 ID 형태)} | ||
*/ | ||
private String movieId; | ||
private String title; | ||
private String posterUrl; | ||
private Genre genre; | ||
private String releaseDate; | ||
private String plot; | ||
private String runningTime; | ||
private String actors; | ||
private String director; | ||
private Long dibCount; | ||
private Long reviewCount; | ||
private Long commentCount; | ||
private Long sumOfRating; | ||
|
||
public void incrementDibCount() { | ||
this.dibCount++; | ||
} | ||
|
||
public void decrementDibCount() { | ||
this.dibCount--; | ||
} | ||
|
||
public void incrementReviewCount() { | ||
this.reviewCount++; | ||
} | ||
|
||
public void decrementReviewCount() { | ||
this.reviewCount--; | ||
} | ||
|
||
public void isCommentedWithRating(int rating) { | ||
this.commentCount++; | ||
this.sumOfRating += rating; | ||
} | ||
|
||
public void deleteComment(int rating) { | ||
this.commentCount--; | ||
this.sumOfRating -= rating; | ||
} | ||
/** | ||
* {@code 알파벳}-{@code 숫자} 형태 {@code (KMDB 영화 ID 형태)} | ||
*/ | ||
private String movieId; | ||
private String title; | ||
private String posterUrl; | ||
private String genre; | ||
private String releaseDate; | ||
private String plot; | ||
private String runningTime; | ||
private String actors; | ||
private String director; | ||
private Long dibCount; | ||
private Long reviewCount; | ||
private Long commentCount; | ||
private Long sumOfRating; | ||
|
||
public void incrementDibCount() { | ||
this.dibCount++; | ||
} | ||
|
||
public void decrementDibCount() { | ||
this.dibCount--; | ||
} | ||
|
||
public void incrementReviewCount() { | ||
this.reviewCount++; | ||
} | ||
|
||
public void decrementReviewCount() { | ||
this.reviewCount--; | ||
} | ||
|
||
public void isCommentedWithRating(int rating) { | ||
this.commentCount++; | ||
this.sumOfRating += rating; | ||
} | ||
|
||
public void deleteComment(int rating) { | ||
this.commentCount--; | ||
this.sumOfRating -= rating; | ||
} | ||
} |
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