-
Notifications
You must be signed in to change notification settings - Fork 2
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 - 일별 챌린지 실패 처리 기능 구현 #45
Merged
kseysh
merged 14 commits into
develop
from
feat/#29-daily-challenge-fauilure-handle-api
Jan 14, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
723a4ce
feat - #29 status를 실패로 변경하는 로직 작성
kseysh ce043c4
feat - #29 챌린지 생성 서비스 작성
kseysh 6a95cc9
feat - #29 챌린지를 createdAt을 이용하여 값을 가져오는 로직 생성
kseysh 60f311f
feat - #29 DayChallenge를 실패로 바꾸는 서비스 정의
kseysh 4bee514
merge - #38 develop 브랜치와 merge
kseysh 22efa37
fix - #38 병합 오류 해결
kseysh 6044f39
chore - #38 rest api 규칙에 맞는 uri 네이밍 설정
kseysh abeb026
del - #38 병합 때 사용되지 않게 된 필드 삭제
kseysh 050a12c
chore - #38 dayChallenge 네이밍 dailyChallenge로 변경
kseysh 24d88c7
feat - #38 dayChallenge 실패 처리 기능 구현
kseysh f05d74b
refactor - #47 사용하지 않는 매개변수 제거 및 status 수정시 status를 매개변수로 받아 확장성 증가
kseysh a011565
merge - #53 develop과 merge전 병합 충돌 해결
kseysh b3715d7
merge - #53 develop과 merge전 병합 충돌 해결
kseysh 2b108c9
merge - #53 develop과 merge전 병합 충돌 해결
kseysh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 0 additions & 2 deletions
2
src/main/java/sopt/org/HMH/domain/challenge/domain/Challenge.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
12 changes: 11 additions & 1 deletion
12
src/main/java/sopt/org/HMH/domain/challenge/repository/ChallengeRepository.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,9 +1,19 @@ | ||
package sopt.org.HMH.domain.challenge.repository; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import sopt.org.HMH.domain.challenge.domain.Challenge; | ||
import sopt.org.HMH.domain.challenge.domain.exception.ChallengeError; | ||
import sopt.org.HMH.domain.challenge.domain.exception.ChallengeException; | ||
|
||
public interface ChallengeRepository extends JpaRepository<Challenge, Long> { | ||
|
||
default Challenge findByUserIdAndCreatedAtBetweenOrThrowException(Long userId, LocalDateTime startDate, LocalDateTime endDate) { | ||
return findByUserIdAndCreatedAtBetween(userId, startDate, endDate).orElseThrow(() -> new ChallengeException( | ||
ChallengeError.CHALLENGE_NOT_FOUND)); | ||
} | ||
Optional<Challenge> findByUserIdAndCreatedAtBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate); | ||
|
||
Challenge findFirstByUserIdOrderByCreatedAtDesc(Long userId); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,22 @@ | |
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import sopt.org.HMH.domain.dailychallenge.domain.exception.DailyChallengeSuccess; | ||
import sopt.org.HMH.domain.dailychallenge.dto.response.DailyChallengeResponse; | ||
import sopt.org.HMH.domain.dailychallenge.repository.DailyChallengeRepository; | ||
import sopt.org.HMH.domain.dailychallenge.service.DailyChallengeService; | ||
import sopt.org.HMH.global.common.response.ApiResponse; | ||
import sopt.org.HMH.global.common.response.EmptyJsonResponse; | ||
import sopt.org.HMH.global.util.IdConverter; | ||
|
||
import java.security.Principal; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/dailyChallenge") | ||
@RequestMapping("/api/v1/dailychallenge") | ||
Comment on lines
-20
to
+21
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. 일반적인 컨벤션과 맞지 않는게 다른 데도 있어서 한 이슈에서 다 수정하려고 했는데 수정하셨군요 url 수정됐다구 클라에게 따로 말해줘야 할 것 같아여 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. 아하 제가 그건 차마 생각을 못했네요.,..!! 노티 정말 감사합니다!! |
||
public class DailyChallengeController { | ||
|
||
private final DailyChallengeService dailyChallengeService; | ||
|
@@ -28,8 +29,18 @@ public ResponseEntity<ApiResponse<DailyChallengeResponse>> orderDetailDailyChall | |
@RequestHeader("OS") final String os | ||
) { | ||
return ResponseEntity | ||
.status(DailyChallengeSuccess.GET_DAY_CHALLENGE_SUCCESS.getHttpStatus()) | ||
.body(ApiResponse.success(DailyChallengeSuccess.GET_DAY_CHALLENGE_SUCCESS, | ||
dailyChallengeService.getDailyChallenge(IdConverter.getUserId(principal), os))); | ||
.status(DailyChallengeSuccess.GET_DAILY_CHALLENGE_SUCCESS.getHttpStatus()) | ||
.body(ApiResponse.success(DailyChallengeSuccess.GET_DAILY_CHALLENGE_SUCCESS, | ||
dailyChallengeService.getDailyChallenge(IdConverter.getUserId(principal)))); | ||
} | ||
|
||
@PatchMapping("/failure") | ||
public ResponseEntity<ApiResponse<?>> orderChallengeDailyChallenge( | ||
Principal principal | ||
) { | ||
dailyChallengeService.modifyDailyChallengeStatus(IdConverter.getUserId(principal)); | ||
return ResponseEntity | ||
.status(DailyChallengeSuccess.MODIFY_DAILY_CHALLENGE_STATUS_SUCCESS.getHttpStatus()) | ||
.body(ApiResponse.success(DailyChallengeSuccess.MODIFY_DAILY_CHALLENGE_STATUS_SUCCESS, new EmptyJsonResponse())); | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ㅋㅋㅋㅋㅋㅋ굳...