Skip to content

Commit

Permalink
merge: 도메인 변경 - #148
Browse files Browse the repository at this point in the history
[SETTING] 도메인 변경 - #148
  • Loading branch information
sjk4618 authored Jan 23, 2025
2 parents 55c3fc2 + 6f326c8 commit 7c5c639
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 80 deletions.
38 changes: 15 additions & 23 deletions cakey-api/src/main/java/com/cakey/store/service/StoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import com.cakey.store.exception.StoreNotfoundException;
import com.cakey.store.facade.StoreFacade;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -28,7 +26,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.cakey.store.exception.StoreErrorCode.STORE_KAKAO_LINK_NOT_FOUND;
Expand Down Expand Up @@ -247,31 +244,26 @@ public StoreDetailInfoRes getStoreDetailInfo(final long storeId) {
throw new StoreNotfoundException(STORE_OPERATION_TIME_NOT_FOUND);
}

final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");

final Function<LocalTime, String> formatTime = time -> time == null ? null : time.format(formatter);

return StoreDetailInfoRes.of(
formatTime.apply(LocalTime.from(storeOperationTimeDto.monOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.monClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.tueOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.tueClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.wedOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.wedClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.thuOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.thuClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.friOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.friClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.satOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.satClose())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.sunOpen())),
formatTime.apply(LocalTime.from(storeOperationTimeDto.sunClose())),
storeOperationTimeDto.monOpen(),
storeOperationTimeDto.monClose(),
storeOperationTimeDto.tueOpen(),
storeOperationTimeDto.tueClose(),
storeOperationTimeDto.wedOpen(),
storeOperationTimeDto.wedClose(),
storeOperationTimeDto.thuOpen(),
storeOperationTimeDto.thuClose(),
storeOperationTimeDto.friOpen(),
storeOperationTimeDto.friClose(),
storeOperationTimeDto.satOpen(),
storeOperationTimeDto.satClose(),
storeOperationTimeDto.sunOpen(),
storeOperationTimeDto.sunClose(),
storeDetailInfoDto.address(),
storeDetailInfoDto.phone()
);
}



public StoreListByPopularityRes getStoreByRank() {
final List<StoreByPopularityDto> storeByPopularityDtoList;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.*;

import java.time.LocalDateTime;
import java.time.LocalTime;

@NoArgsConstructor(access = AccessLevel.PROTECTED) //JPA에서만 사용가능하도록
@AllArgsConstructor(access = AccessLevel.PRIVATE) // 외부에서 직접 모든 필드 받는 생성자 호출X
Expand All @@ -21,63 +22,63 @@ public class StoreOperationTime {
private long storeId;

@Column(name = "mon_open", nullable = true)
private LocalDateTime monOpen;
private String monOpen;

@Column(name = "mon_close", nullable = true)
private LocalDateTime monClose;
private String monClose;

@Column(name = "tue_open", nullable = true)
private LocalDateTime tueOpen;
private String tueOpen;

@Column(name = "tue_close", nullable = true)
private LocalDateTime tueClose;
private String tueClose;

@Column(name = "wed_open", nullable = true)
private LocalDateTime wedOpen;
private String wedOpen;

@Column(name = "wed_close", nullable = true)
private LocalDateTime wedClose;
private String wedClose;

@Column(name = "thu_open", nullable = true)
private LocalDateTime thuOpen;
private String thuOpen;

@Column(name = "thu_close", nullable = true)
private LocalDateTime thuClose;
private String thuClose;

@Column(name = "fri_open", nullable = true)
private LocalDateTime friOpen;
private String friOpen;

@Column(name = "fri_close", nullable = true)
private LocalDateTime friClose;
private String friClose;

@Column(name = "sat_open", nullable = true)
private LocalDateTime satOpen;
private String satOpen;

@Column(name = "sat_close", nullable = true)
private LocalDateTime satClose;
private String satClose;

@Column(name = "sun_open", nullable = true)
private LocalDateTime sunOpen;
private String sunOpen;

@Column(name = "sun_close", nullable = true)
private LocalDateTime sunClose;
private String sunClose;

public static StoreOperationTime createStoreOperationTime(
final long storeId,
final LocalDateTime monOpen,
final LocalDateTime monClose,
final LocalDateTime tueOpen,
final LocalDateTime tueClose,
final LocalDateTime wedOpen,
final LocalDateTime wedClose,
final LocalDateTime thuOpen,
final LocalDateTime thuClose,
final LocalDateTime friOpen,
final LocalDateTime friClose,
final LocalDateTime satOpen,
final LocalDateTime satClose,
final LocalDateTime sunOpen,
final LocalDateTime sunClose
final String monOpen,
final String monClose,
final String tueOpen,
final String tueClose,
final String wedOpen,
final String wedClose,
final String thuOpen,
final String thuClose,
final String friOpen,
final String friClose,
final String satOpen,
final String satClose,
final String sunOpen,
final String sunClose
) {
return StoreOperationTime.builder()
.storeId(storeId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@

@Builder(access = AccessLevel.PRIVATE)
public record StoreOperationTimeDto(
LocalDateTime monOpen,
LocalDateTime monClose,
LocalDateTime tueOpen,
LocalDateTime tueClose,
LocalDateTime wedOpen,
LocalDateTime wedClose,
LocalDateTime thuOpen,
LocalDateTime thuClose,
LocalDateTime friOpen,
LocalDateTime friClose,
LocalDateTime satOpen,
LocalDateTime satClose,
LocalDateTime sunOpen,
LocalDateTime sunClose
String monOpen,
String monClose,
String tueOpen,
String tueClose,
String wedOpen,
String wedClose,
String thuOpen,
String thuClose,
String friOpen,
String friClose,
String satOpen,
String satClose,
String sunOpen,
String sunClose
) {
public static StoreOperationTimeDto of(final LocalDateTime monOpen,
final LocalDateTime monClose,
final LocalDateTime tueOpen,
final LocalDateTime tueClose,
final LocalDateTime wedOpen,
final LocalDateTime wedClose,
final LocalDateTime thuOpen,
final LocalDateTime thuClose,
final LocalDateTime friOpen,
final LocalDateTime friClose,
final LocalDateTime satOpen,
final LocalDateTime satClose,
final LocalDateTime sunOpen,
final LocalDateTime sunClose) {
public static StoreOperationTimeDto of(final String monOpen,
final String monClose,
final String tueOpen,
final String tueClose,
final String wedOpen,
final String wedClose,
final String thuOpen,
final String thuClose,
final String friOpen,
final String friClose,
final String satOpen,
final String satClose,
final String sunOpen,
final String sunClose) {
return StoreOperationTimeDto.builder()
.monOpen(monOpen)
.monClose(monClose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Store extends BaseTimeEntity {
@Column(name = "address", nullable = false)
private String address;

@Column(name = "phone", nullable = false)
@Column(name = "phone", nullable = true)
private String phone;

@Column(name = "latitude", nullable = false)
Expand Down

0 comments on commit 7c5c639

Please sign in to comment.