-
Notifications
You must be signed in to change notification settings - Fork 0
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 #53 from Parkjyun/feat/39
[feat] 큐레이션 관련 api 추가
- Loading branch information
Showing
9 changed files
with
105 additions
and
13 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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/newsnack/www/newsnackserver/domain/member/model/Interest.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,12 @@ | ||
package com.newsnack.www.newsnackserver.domain.member.model; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public enum Interest { | ||
MONEY("MONEY"), SOCIETY("SOCIETY"), TREND("TREND"); | ||
|
||
private final String value; | ||
} |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/newsnack/www/newsnackserver/dto/request/MemberUpdateInterestRequest.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,19 @@ | ||
package com.newsnack.www.newsnackserver.dto.request; | ||
|
||
import com.newsnack.www.newsnackserver.domain.member.model.Interest; | ||
import jakarta.validation.constraints.Max; | ||
import jakarta.validation.constraints.Min; | ||
|
||
public record MemberUpdateInterestRequest(@Max(value = 3, message = "3이하의 점수를 입력하세요") @Min(value = 0, message = "0이상의 점수를 입력하세요") int moneyCount, | ||
@Max(value = 3, message = "3이하의 점수를 입력하세요") @Min(value = 0, message = "0이상의 점수를 입력하세요") int societyCount, | ||
@Max(value = 3, message = "3이하의 점수를 입력하세요") @Min(value = 0, message = "0이상의 점수를 입력하세요") int trendCount) { | ||
public Interest getInterestWithMostCount() { | ||
if (moneyCount >= societyCount && moneyCount >= trendCount) { | ||
return Interest.MONEY; | ||
} else if (societyCount >= moneyCount && societyCount >= trendCount) { | ||
return Interest.SOCIETY; | ||
} else { | ||
return Interest.TREND; | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/newsnack/www/newsnackserver/dto/response/InterestedArticleResponse.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,9 @@ | ||
package com.newsnack.www.newsnackserver.dto.response; | ||
|
||
import com.newsnack.www.newsnackserver.domain.article.model.Article; | ||
|
||
public record InterestedArticleResponse(Long id, String imageUrl, String title) { | ||
public static InterestedArticleResponse of(Article article) { | ||
return new InterestedArticleResponse(article.getId(), article.getImageUrl(), article.getTitle()); | ||
} | ||
} |
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