-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 챌린지 참가 정보 수정 API, 참가중인 챌린지 조회 API 수정 #270
Changes from 4 commits
b683be8
a5b17db
fe8cf7e
2a1902c
5052c94
375306a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,10 @@ | |
public class ParticipatingChallengeResponse { | ||
private Long challengeId; | ||
private String name; | ||
private Long participatingUserNumber; | ||
private String interest; | ||
private String myTopic; | ||
private int insightPerWeek; | ||
private int duration; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duration이 화면의 뭘 의미하는건지 잘 모르겠어요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 화면에서는 참가 기간이에요. |
||
private String endDate; | ||
private String startDate; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ccc.keeweapi.dto.challenge; | ||
|
||
import ccc.keeweapi.validator.annotations.GraphemeLength; | ||
import lombok.Getter; | ||
|
||
import javax.validation.constraints.Max; | ||
import javax.validation.constraints.Min; | ||
|
||
@Getter | ||
public class ParticipationUpdateRequest { | ||
@GraphemeLength(max = 150) | ||
private String myTopic; | ||
|
||
@Min(1) @Max(7) | ||
private int insightPerWeek; | ||
|
||
@Min(2) @Max(8) | ||
private int duration; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,12 @@ | |
import ccc.keeweapi.dto.challenge.ParticipatingChallengeDetailResponse; | ||
import ccc.keeweapi.dto.challenge.ParticipatingChallengeResponse; | ||
import ccc.keeweapi.dto.challenge.ParticipationCheckResponse; | ||
import ccc.keeweapi.dto.challenge.ParticipationUpdateRequest; | ||
import ccc.keeweapi.dto.challenge.WeekProgressResponse; | ||
import ccc.keeweapi.utils.SecurityUtil; | ||
import ccc.keewecore.consts.KeeweRtnConsts; | ||
import ccc.keewecore.exception.KeeweException; | ||
import ccc.keewedomain.dto.challenge.ParticipationUpdateDto; | ||
import ccc.keewedomain.persistence.domain.challenge.Challenge; | ||
import ccc.keewedomain.persistence.domain.challenge.ChallengeParticipation; | ||
import ccc.keewedomain.persistence.domain.user.User; | ||
|
@@ -99,12 +101,9 @@ public WeekProgressResponse getWeekProgress() { | |
} | ||
|
||
@Transactional(readOnly = true) | ||
public ParticipatingChallengeResponse getParticipatingChallenege() { | ||
public ParticipatingChallengeResponse getParticipatingChallenge() { | ||
return challengeParticipateQueryDomainService.findCurrentChallengeParticipation(SecurityUtil.getUser()) | ||
.map(participation -> { | ||
Long participatingUser = challengeParticipateQueryDomainService.countParticipatingUser(participation.getChallenge()); | ||
return challengeAssembler.toMyChallengeResponse(participation, participatingUser); | ||
}) | ||
.map(challengeAssembler::toMyChallengeResponse) | ||
.orElse(null); | ||
} | ||
|
||
|
@@ -164,4 +163,11 @@ public ChallengeInsightNumberResponse countInsightOfChallenge(Long writerId) { | |
.orElseThrow(() -> new KeeweException(KeeweRtnConsts.ERR432)); | ||
return challengeAssembler.toChallengeInsightNumberResponse(insightNumber); | ||
} | ||
|
||
@Transactional | ||
public void updateParticipation(ParticipationUpdateRequest request) { | ||
ChallengeParticipation participation = challengeParticipateQueryDomainService.getCurrentChallengeParticipation(SecurityUtil.getUser()); | ||
ParticipationUpdateDto dto = challengeAssembler.toParticipationUpdateDto(request); | ||
challengeCommandDomainService.updateParticipation(participation, dto); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dto를 따로 만든김에 participation 정보를 포함해서 뭉치는게 좋지않을까요? 혹은 domain service에서 조회하는 것도 고려할 수 있을거같아요~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. userId를 포함시키는 방법으로 생각해볼게요 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ccc.keewedomain.dto.challenge; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor(staticName = "of") | ||
public class ParticipationUpdateDto { | ||
private String myTopic; | ||
private int insightPerWeek; | ||
private int duration; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미 존재하는 API같은데, 왜 변경되는거에요?
이 API를 여러곳에서 쓰나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
챌린지 홈에서 쓰고 있어요. 참가중인 챌린지 정보를 조회하는데 홈이냐 상세이냐에 따라 API를 구분하는게 이상해서 변경으로 진행했어요.