Skip to content

Commit

Permalink
fix: 절기 조회 API 응답 recordTerm.date를 등록 마감일로 정정
Browse files Browse the repository at this point in the history
  • Loading branch information
csct3434 committed Jan 30, 2024
1 parent 89ea3b1 commit c1b5c18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ public class FindSolarTermInfoResponse {
private final SolarTermDto nextTerm;
private final SolarTermDto recordTerm;

public static FindSolarTermInfoResponse build(SolarTerm currentSolarTerm, SolarTerm nextSolarTerm, SolarTerm recordSolarTerm) {
public static FindSolarTermInfoResponse build(SolarTerm currentSolarTerm, SolarTerm nextSolarTerm, SolarTerm recordSolarTerm, int recordPeriod) {
boolean recordable = recordSolarTerm != null;
SolarTermDto currentTerm = SolarTermDto.build(currentSolarTerm);
SolarTermDto nextTerm = SolarTermDto.build(nextSolarTerm);
SolarTermDto recordTerm = recordable ? SolarTermDto.build(recordSolarTerm) : null;

SolarTermDto recordTerm = null;
if(recordable) {
recordTerm = new SolarTermDto(
recordSolarTerm.getSequence(),
recordSolarTerm.getDate().plusDays(recordPeriod));
}

return new FindSolarTermInfoResponse(recordable, currentTerm, nextTerm, recordTerm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public Optional<SolarTerm> findRecordSolarTerm() {
}

public FindSolarTermInfoResponse findSolarTermInfo() {
return FindSolarTermInfoResponse.build(currentSolarTerm, nextSolarTerm, recordSolarTerm.orElse(null));
return FindSolarTermInfoResponse.build(currentSolarTerm, nextSolarTerm, recordSolarTerm.orElse(null),
ARTICLE_REGISTRATION_PERIOD);
}
}

0 comments on commit c1b5c18

Please sign in to comment.