-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Be/fix] 특정 날짜의 식사 정보 조회하는 API 오류 수정
- Loading branch information
Showing
27 changed files
with
271 additions
and
77 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
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
10 changes: 10 additions & 0 deletions
10
.../main/java/com/gaebaljip/exceed/application/port/in/meal/ValidateBeforeSignUpUsecase.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,10 @@ | ||
package com.gaebaljip.exceed.application.port.in.meal; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import com.gaebaljip.exceed.common.annotation.UseCase; | ||
|
||
@UseCase | ||
public interface ValidateBeforeSignUpUsecase { | ||
void execute(Long memberId, LocalDateTime dateTime); | ||
} |
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
27 changes: 27 additions & 0 deletions
27
.../main/java/com/gaebaljip/exceed/application/service/meal/ValidateBeforeSignupService.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,27 @@ | ||
package com.gaebaljip.exceed.application.service.meal; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import com.gaebaljip.exceed.adapter.out.jpa.member.MemberPersistenceAdapter; | ||
import com.gaebaljip.exceed.application.domain.member.MemberEntity; | ||
import com.gaebaljip.exceed.application.port.in.meal.ValidateBeforeSignUpUsecase; | ||
import com.gaebaljip.exceed.common.exception.meal.InValidDateFoundException; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ValidateBeforeSignupService implements ValidateBeforeSignUpUsecase { | ||
|
||
private final MemberPersistenceAdapter memberPersistenceAdapter; | ||
|
||
@Override | ||
public void execute(Long memberId, LocalDateTime dateTime) { | ||
MemberEntity memberEntity = memberPersistenceAdapter.query(memberId); | ||
if (memberEntity.checkIfBeforeSignUp(dateTime)) { | ||
throw InValidDateFoundException.EXECPTION; | ||
} | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
...d/src/main/java/com/gaebaljip/exceed/common/exception/meal/InValidDateFoundException.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,14 @@ | ||
package com.gaebaljip.exceed.common.exception.meal; | ||
|
||
import com.gaebaljip.exceed.common.exception.EatCeedException; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class InValidDateFoundException extends EatCeedException { | ||
public static EatCeedException EXECPTION = new InValidDateFoundException(); | ||
|
||
public InValidDateFoundException() { | ||
super(MealError.INVALID_DATE_FOUND); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...a/com/gaebaljip/exceed/adapter/out/jpa/member/custom/CustomHistoryRepositoryImplTest.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,28 @@ | ||
package com.gaebaljip.exceed.adapter.out.jpa.member.custom; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import com.gaebaljip.exceed.application.domain.member.HistoryEntity; | ||
import com.gaebaljip.exceed.common.DatabaseTest; | ||
|
||
class CustomHistoryRepositoryImplTest extends DatabaseTest { | ||
|
||
@Autowired private CustomHistoryRepositoryImpl customHistoryRepository; | ||
|
||
@Test | ||
@DisplayName( | ||
"회원 1L : 2023-12-03 11:00:00, 2023-12-05 09:00:00, 그리고 2023-12-07 09:00:00에 회원 수정" | ||
+ "2023-12-04의 회원 정보를 열람할 경우 2023-12-05 09:00:00 에 저장된 회원 정보를 조회해야한다.") | ||
void when_findMostRecentFutureMemberWeight_expected_72() { | ||
LocalDateTime dateTime = LocalDateTime.of(2023, 12, 04, 12, 00); | ||
HistoryEntity historyEntity = | ||
customHistoryRepository.findMostRecentFutureMember(1L, dateTime); | ||
assertEquals(historyEntity.getWeight(), 72.0); | ||
} | ||
} |
Oops, something went wrong.