-
Notifications
You must be signed in to change notification settings - Fork 1
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 #140 from 9oormthon-univ/fix/store
Fix/store
- Loading branch information
Showing
4 changed files
with
60 additions
and
5 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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/jangburich/domain/store/dto/StoreTeamResponse.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,39 @@ | ||
package com.jangburich.domain.store.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class StoreTeamResponse { | ||
Long id; | ||
Integer remainPoint; | ||
Long teamId; | ||
String teamName; | ||
String teamDescription; | ||
Long storeId; | ||
String period; | ||
|
||
public StoreTeamResponse(Long id, Integer remainPoint, Long teamId, String teamName, String teamDescription, | ||
Long storeId, LocalDateTime period, long maxReservation) { | ||
this.id = id; | ||
this.remainPoint = remainPoint; | ||
this.teamId = teamId; | ||
this.teamName = teamName; | ||
this.teamDescription = teamDescription; | ||
this.storeId = storeId; | ||
this.period = calculateDateRange(period, maxReservation); | ||
} | ||
|
||
private String calculateDateRange(LocalDateTime updatedAt, long maxReservation) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); | ||
|
||
// ์์ ๋ ์ง | ||
String startDate = updatedAt.format(formatter); | ||
|
||
// ์ข ๋ฃ ๋ ์ง | ||
LocalDateTime endDateTime = updatedAt.plusDays(maxReservation); | ||
String endDate = endDateTime.format(formatter); | ||
|
||
// ๋ฒ์ ๋ฌธ์์ด ์์ฑ | ||
return startDate + " ~ " + endDate; | ||
} | ||
} |
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