Skip to content

Commit 59eef43

Browse files
committed
chore: 코드 리뷰 사항 반영
- 일부 mapper 클래스의 네이밍을 수정 - mapper 클래스의 디렉토리 위치 수정 - 응답 클래스에 대한 스웨거 작
1 parent f8298b9 commit 59eef43

File tree

14 files changed

+59
-55
lines changed

14 files changed

+59
-55
lines changed

src/main/java/com/somemore/center/repository/CenterRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.somemore.center.repository;
22

33
import com.somemore.center.domain.Center;
4-
import com.somemore.center.dto.response.CenterOverviewInfoResponseDto;
4+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
55
import org.springframework.stereotype.Repository;
66

77
import java.util.List;
@@ -16,6 +16,6 @@ default boolean doesNotExistById(UUID id) {
1616
return !existsById(id);
1717
}
1818
Optional<Center> findCenterById(UUID id);
19-
List<CenterOverviewInfoResponseDto> findCenterOverviewsByIds(List<UUID> ids);
19+
List<CenterOverviewInfo> findCenterOverviewsByIds(List<UUID> ids);
2020
void deleteAllInBatch();
2121
}

src/main/java/com/somemore/center/repository/CenterRepositoryImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.querydsl.jpa.impl.JPAQueryFactory;
55
import com.somemore.center.domain.Center;
66
import com.somemore.center.domain.QCenter;
7-
import com.somemore.center.dto.response.CenterOverviewInfoResponseDto;
7+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
88
import lombok.RequiredArgsConstructor;
99
import org.springframework.stereotype.Repository;
1010

@@ -35,12 +35,12 @@ public Optional<Center> findCenterById(UUID id) {
3535
}
3636

3737
@Override
38-
public List<CenterOverviewInfoResponseDto> findCenterOverviewsByIds(List<UUID> ids) {
38+
public List<CenterOverviewInfo> findCenterOverviewsByIds(List<UUID> ids) {
3939
QCenter center = QCenter.center;
4040

4141
return queryFactory
4242
.select(Projections.constructor(
43-
CenterOverviewInfoResponseDto.class,
43+
CenterOverviewInfo.class,
4444
center.id,
4545
center.name,
4646
center.imgUrl

src/main/java/com/somemore/center/dto/response/CenterOverviewInfoResponseDto.java renamed to src/main/java/com/somemore/center/repository/mapper/CenterOverviewInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.somemore.center.dto.response;
1+
package com.somemore.center.repository.mapper;
22

33

44
import java.util.UUID;
55

6-
public record CenterOverviewInfoResponseDto(
6+
public record CenterOverviewInfo(
77
UUID centerId,
88
String centerName,
99
String imgUrl

src/main/java/com/somemore/center/service/query/CenterQueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.somemore.center.service.query;
22

33
import com.somemore.center.domain.Center;
4-
import com.somemore.center.dto.response.CenterOverviewInfoResponseDto;
4+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
55
import com.somemore.center.dto.response.CenterProfileResponseDto;
66
import com.somemore.center.dto.response.PreferItemResponseDto;
77
import com.somemore.center.repository.CenterRepository;
@@ -35,7 +35,7 @@ public CenterProfileResponseDto getCenterProfileByCenterId(UUID centerId) {
3535
}
3636

3737
@Override
38-
public List<CenterOverviewInfoResponseDto> getCenterOverviewsByIds(List<UUID> centerIds) {
38+
public List<CenterOverviewInfo> getCenterOverviewsByIds(List<UUID> centerIds) {
3939
return centerRepository.findCenterOverviewsByIds(centerIds);
4040
}
4141

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.somemore.center.usecase.query;
22

3-
import com.somemore.center.dto.response.CenterOverviewInfoResponseDto;
3+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
44
import com.somemore.center.dto.response.CenterProfileResponseDto;
55

66
import java.util.List;
77
import java.util.UUID;
88

99
public interface CenterQueryUseCase {
1010
CenterProfileResponseDto getCenterProfileByCenterId(UUID centerId);
11-
List<CenterOverviewInfoResponseDto> getCenterOverviewsByIds(List<UUID> centerIds);
11+
List<CenterOverviewInfo> getCenterOverviewsByIds(List<UUID> centerIds);
1212
void validateCenterExists(UUID centerId);
1313
}

src/main/java/com/somemore/interestcenter/controller/InterestCenterQueryApiController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.somemore.interestcenter.controller;
22

33
import com.somemore.global.common.response.ApiResponse;
4-
import com.somemore.interestcenter.dto.response.GetInterestCentersResponseDto;
4+
import com.somemore.interestcenter.dto.response.InterestCentersResponseDto;
55
import com.somemore.interestcenter.usecase.InterestCenterQueryUseCase;
66
import io.swagger.v3.oas.annotations.Operation;
77
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -22,9 +22,9 @@ public class InterestCenterQueryApiController {
2222

2323
@Operation(summary = "관심기관 목록 조회 API")
2424
@GetMapping("/api/interest-centers")
25-
public ApiResponse<List<GetInterestCentersResponseDto>> getInterestCenters(@AuthenticationPrincipal String volunteerId) {
25+
public ApiResponse<List<InterestCentersResponseDto>> getInterestCenters(@AuthenticationPrincipal String volunteerId) {
2626

27-
List<GetInterestCentersResponseDto> responseDtos = interestCenterQueryUseCase.getInterestCenters(UUID.fromString(volunteerId));
27+
List<InterestCentersResponseDto> responseDtos = interestCenterQueryUseCase.getInterestCenters(UUID.fromString(volunteerId));
2828

2929
return ApiResponse.ok(200, responseDtos, "관심기관 조회 성공");
3030
}

src/main/java/com/somemore/interestcenter/dto/response/GetInterestCentersResponseDto.java

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.somemore.interestcenter.dto.response;
2+
3+
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4+
import com.fasterxml.jackson.databind.annotation.JsonNaming;
5+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
6+
import io.swagger.v3.oas.annotations.media.Schema;
7+
import lombok.Builder;
8+
9+
import java.util.UUID;
10+
11+
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
12+
@Builder
13+
public record InterestCentersResponseDto(
14+
@Schema(description = "관심기관의 ID", example = "123e4567-e89b-12d3-a456-426614174000")
15+
UUID centerId,
16+
@Schema(description = "관심기관의 이름", example = "서울 도서관")
17+
String centerName,
18+
@Schema(description = "관심기관의 프로필 이미지 링크", example = "~~/image.jpeg")
19+
String imgUrl
20+
) {
21+
public static InterestCentersResponseDto of(CenterOverviewInfo responseDto) {
22+
return InterestCentersResponseDto.builder()
23+
.centerId(responseDto.centerId())
24+
.centerName(responseDto.centerName())
25+
.imgUrl(responseDto.imgUrl())
26+
.build();
27+
}
28+
}

src/main/java/com/somemore/interestcenter/dto/response/RegisterInterestCenterResponseDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public record RegisterInterestCenterResponseDto(
1717
@Schema(description = "봉사자 ID", example = "123e4567-e89b-12d3-a456-426614174000")
1818
UUID volunteerId,
1919

20-
@Schema(description = "센터 ID", example = "123e4567-e89b-12d3-a456-426614174000")
20+
@Schema(description = "기관 ID", example = "123e4567-e89b-12d3-a456-426614174000")
2121
UUID centerId
2222
) {
2323
public static RegisterInterestCenterResponseDto from(InterestCenter interestCenter) {

src/main/java/com/somemore/interestcenter/service/InterestCenterQueryService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.somemore.interestcenter.service;
22

3-
import com.somemore.center.dto.response.CenterOverviewInfoResponseDto;
3+
import com.somemore.center.repository.mapper.CenterOverviewInfo;
44
import com.somemore.center.usecase.query.CenterQueryUseCase;
5-
import com.somemore.interestcenter.dto.response.GetInterestCentersResponseDto;
5+
import com.somemore.interestcenter.dto.response.InterestCentersResponseDto;
66
import com.somemore.interestcenter.repository.InterestCenterRepository;
77
import com.somemore.interestcenter.usecase.InterestCenterQueryUseCase;
88
import lombok.RequiredArgsConstructor;
@@ -19,16 +19,16 @@ public class InterestCenterQueryService implements InterestCenterQueryUseCase {
1919
private final InterestCenterRepository interestCenterRepository;
2020

2121
@Override
22-
public List<GetInterestCentersResponseDto> getInterestCenters(UUID volunteerId) {
22+
public List<InterestCentersResponseDto> getInterestCenters(UUID volunteerId) {
2323

2424
List<UUID> interestCenterIds = interestCenterRepository.findInterestCenterIdsByVolunteerId(volunteerId);
2525
if (interestCenterIds.isEmpty()) {
2626
return List.of();
2727
}
2828

29-
List<CenterOverviewInfoResponseDto> centerOverviews = centerQueryUseCase.getCenterOverviewsByIds(interestCenterIds);
29+
List<CenterOverviewInfo> centerOverviews = centerQueryUseCase.getCenterOverviewsByIds(interestCenterIds);
3030
return centerOverviews.stream()
31-
.map(GetInterestCentersResponseDto::of)
31+
.map(InterestCentersResponseDto::of)
3232
.toList();
3333
}
3434
}

0 commit comments

Comments
 (0)