Skip to content

Commit e8cc74d

Browse files
committed
fix: 코드 재정렬
1 parent 9593255 commit e8cc74d

File tree

11 files changed

+50
-61
lines changed

11 files changed

+50
-61
lines changed

src/main/java/eatda/domain/Image.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@
33
import eatda.exception.BusinessErrorCode;
44
import eatda.exception.BusinessException;
55
import java.util.Set;
6-
import lombok.Getter;
76
import org.springframework.lang.Nullable;
87
import org.springframework.web.multipart.MultipartFile;
98

10-
@Getter
11-
public class Image {
9+
public record Image(ImageDomain domain, MultipartFile file) {
1210

1311
private static final Set<String> ALLOWED_CONTENT_TYPES = Set.of("image/jpg", "image/jpeg", "image/png");
1412
private static final String EXTENSION_DELIMITER = ".";
1513
private static final String DEFAULT_CONTENT_TYPE = "bin";
1614

17-
private final ImageDomain domain;
18-
private final MultipartFile file;
19-
2015
public Image(ImageDomain domain, @Nullable MultipartFile file) {
2116
validateContentType(file);
2217
this.domain = domain;

src/main/java/eatda/domain/store/Coordinates.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ public class Coordinates {
1919
private static final double MAX_LATITUDE = 37.715133;
2020
private static final double MIN_LONGITUDE = 126.734086;
2121
private static final double MAX_LONGITUDE = 127.269311;
22+
@Column(nullable = false)
23+
private Double latitude;
24+
@Column(nullable = false)
25+
private Double longitude;
26+
27+
public Coordinates(Double latitude, Double longitude) {
28+
validate(latitude, longitude);
29+
this.latitude = latitude;
30+
this.longitude = longitude;
31+
}
2232

2333
public static double getMinLatitude() {
2434
return MIN_LATITUDE;
@@ -36,18 +46,6 @@ public static double getMaxLongitude() {
3646
return MAX_LONGITUDE;
3747
}
3848

39-
@Column(nullable = false)
40-
private Double latitude;
41-
42-
@Column(nullable = false)
43-
private Double longitude;
44-
45-
public Coordinates(Double latitude, Double longitude) {
46-
validate(latitude, longitude);
47-
this.latitude = latitude;
48-
this.longitude = longitude;
49-
}
50-
5149
private void validate(Double latitude, Double longitude) {
5250
validateNotNull(latitude, longitude);
5351
validateRange(latitude, longitude);

src/main/java/eatda/storage/image/ExternalImageStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public ExternalImageStorage(FileClient fileClient) {
2222

2323
public ImageKey upload(Image image) {
2424
String createdKey = createKey(image.getDomainName(), image.getExtension());
25-
fileClient.upload(image.getFile(), createdKey);
25+
fileClient.upload(image.file(), createdKey);
2626
return new ImageKey(createdKey);
2727
}
2828

src/main/resources/db/migration/V1__init.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ CREATE TABLE `store`
2020
`place_url` VARCHAR(255) NOT NULL,
2121
`road_address` VARCHAR(255) NOT NULL,
2222
`lot_number_address` VARCHAR(255) NOT NULL,
23-
`latitude` DOUBLE NOT NULL,
24-
`longitude` DOUBLE NOT NULL,
23+
`latitude` DOUBLE NOT NULL,
24+
`longitude` DOUBLE NOT NULL,
2525
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
2626
PRIMARY KEY (`id`)
2727
);
2828

2929
CREATE TABLE `cheer`
3030
(
31-
`id` BIGINT NOT NULL AUTO_INCREMENT,
32-
`member_id` BIGINT NOT NULL,
33-
`store_id` BIGINT NOT NULL,
34-
`description` TEXT NOT NULL,
31+
`id` BIGINT NOT NULL AUTO_INCREMENT,
32+
`member_id` BIGINT NOT NULL,
33+
`store_id` BIGINT NOT NULL,
34+
`description` TEXT NOT NULL,
3535
`image_key` VARCHAR(511) NULL,
36-
`is_admin` BOOLEAN NOT NULL DEFAULT FALSE,
37-
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
36+
`is_admin` BOOLEAN NOT NULL DEFAULT FALSE,
37+
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
3838
PRIMARY KEY (`id`),
3939
FOREIGN KEY (`member_id`) REFERENCES `member` (`id`) ON DELETE CASCADE,
4040
FOREIGN KEY (`store_id`) REFERENCES `store` (`id`) ON DELETE CASCADE
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
ALTER TABLE story MODIFY COLUMN description TEXT NULL;
1+
ALTER TABLE story
2+
MODIFY COLUMN description TEXT NULL;

src/test/java/eatda/client/map/KakaoPropertiesTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.assertj.core.api.Assertions.assertThatCode;
44
import static org.assertj.core.api.Assertions.assertThatThrownBy;
5-
import static org.junit.jupiter.api.Assertions.*;
65

76
import org.junit.jupiter.api.Nested;
87
import org.junit.jupiter.api.Test;

src/test/java/eatda/domain/store/StoreSearchFilterTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class StoreSearchFilterTest {
1515

1616
private final StoreSearchFilter storeSearchFilter = new StoreSearchFilter();
1717

18+
private MapClientStoreSearchResult createStore(String id, String name, String categoryGroupCode,
19+
String location) {
20+
return new MapClientStoreSearchResult(id, categoryGroupCode, "음식점 > 식당", "010-1234-1234", name,
21+
"https://yapp.co.kr", location, null, 37.0d, 128.0d);
22+
}
23+
1824
@Nested
1925
class FilterSearchedStores {
2026

@@ -71,10 +77,4 @@ class FilterStoreByKakaoId {
7177
assertThat(exception.getErrorCode()).isEqualTo(BusinessErrorCode.STORE_NOT_FOUND);
7278
}
7379
}
74-
75-
private MapClientStoreSearchResult createStore(String id, String name, String categoryGroupCode,
76-
String location) {
77-
return new MapClientStoreSearchResult(id, categoryGroupCode, "음식점 > 식당", "010-1234-1234", name,
78-
"https://yapp.co.kr", location, null, 37.0d, 128.0d);
79-
}
8080
}

src/test/java/eatda/exception/GlobalExceptionHandlerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
@ActiveProfiles("local")
4848
class GlobalExceptionHandlerTest {
4949

50+
@Autowired
51+
private MockMvc mockMvc;
52+
5053
@TestConfiguration
5154
static class TestCorsConfig {
5255
@Bean
@@ -124,9 +127,6 @@ public void setField(String field) {
124127
}
125128
}
126129

127-
@Autowired
128-
private MockMvc mockMvc;
129-
130130
@Nested
131131
class handleExceptions {
132132

src/test/java/eatda/service/store/StoreSearchServiceTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515

1616
class StoreSearchServiceTest extends BaseServiceTest {
1717

18+
void mockingMapClient() {
19+
List<MapClientStoreSearchResult> searchResults = List.of(
20+
new MapClientStoreSearchResult("123", "FD6", "음식점 > 한식 > 국밥", "010-1234-1234", "농민백암순대 본점",
21+
"https://yapp.co.kr", "서울 강남구 대치동 896-33", "서울 강남구 선릉로86길 40-4", 37.0d, 128.0d),
22+
new MapClientStoreSearchResult("456", "FD6", "음식점 > 한식 > 국밥", "010-1234-1234", "농민백암순대 시청점",
23+
"http://yapp.kr", "서울 중구 북창동 19-4", null, 37.0d, 128.0d)
24+
);
25+
doReturn(searchResults).when(mapClient).searchStores(anyString());
26+
}
27+
1828
@Nested
1929
class SearchStoreByKakaoId {
2030

@@ -54,14 +64,4 @@ class SearchStores {
5464
);
5565
}
5666
}
57-
58-
void mockingMapClient() {
59-
List<MapClientStoreSearchResult> searchResults = List.of(
60-
new MapClientStoreSearchResult("123", "FD6", "음식점 > 한식 > 국밥", "010-1234-1234", "농민백암순대 본점",
61-
"https://yapp.co.kr", "서울 강남구 대치동 896-33", "서울 강남구 선릉로86길 40-4", 37.0d, 128.0d),
62-
new MapClientStoreSearchResult("456", "FD6", "음식점 > 한식 > 국밥", "010-1234-1234", "농민백암순대 시청점",
63-
"http://yapp.kr", "서울 중구 북창동 19-4", null, 37.0d, 128.0d)
64-
);
65-
doReturn(searchResults).when(mapClient).searchStores(anyString());
66-
}
6767
}

src/test/java/eatda/service/store/StoreServiceTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
import static org.assertj.core.api.Assertions.assertThat;
44
import static org.junit.jupiter.api.Assertions.assertAll;
55
import static org.junit.jupiter.api.Assertions.assertThrows;
6-
import static org.mockito.ArgumentMatchers.anyString;
7-
import static org.mockito.Mockito.doReturn;
86

9-
import eatda.client.map.MapClientStoreSearchResult;
107
import eatda.controller.store.ImagesResponse;
118
import eatda.controller.store.StoreResponse;
129
import eatda.domain.member.Member;
@@ -16,7 +13,6 @@
1613
import eatda.exception.BusinessException;
1714
import eatda.service.BaseServiceTest;
1815
import java.time.LocalDateTime;
19-
import java.util.List;
2016
import org.junit.jupiter.api.Nested;
2117
import org.junit.jupiter.api.Test;
2218
import org.springframework.beans.factory.annotation.Autowired;

0 commit comments

Comments
 (0)