Skip to content

Commit

Permalink
[CHORE] dto 클래스명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Chan531 committed Jun 21, 2024
1 parent 03b39f8 commit 641add7
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.soptie.server.memberRoutine.controller.v1.api.MemberDailyRoutineApi;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineAchieveResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineCreateResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineListGetResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineListAcquireResponse;
import com.soptie.server.memberRoutine.service.MemberRoutineCreateService;
import com.soptie.server.memberRoutine.controller.v1.dto.request.MemberDailyRoutineCreateRequest;
import com.soptie.server.memberRoutine.service.MemberRoutineDeleteService;
Expand All @@ -32,7 +32,7 @@
import com.soptie.server.memberRoutine.service.dto.request.MemberRoutineAchieveServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineCreateServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberRoutinesDeleteServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListGetServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListAcquireServiceRequest;

import lombok.RequiredArgsConstructor;
import lombok.val;
Expand Down Expand Up @@ -83,12 +83,12 @@ public ResponseEntity<SuccessResponse<MemberDailyRoutineAchieveResponse>> achiev
}

@GetMapping
public ResponseEntity<SuccessResponse<MemberDailyRoutineListGetResponse>> getMemberDailyRoutines(
public ResponseEntity<SuccessResponse<MemberDailyRoutineListAcquireResponse>> getMemberDailyRoutines(
Principal principal
) {
val memberId = Long.parseLong(principal.getName());
val response = MemberDailyRoutineListGetResponse
.of(memberRoutineReadService.getDailyRoutines(MemberDailyRoutineListGetServiceRequest.of(memberId)));
val response = MemberDailyRoutineListAcquireResponse
.of(memberRoutineReadService.getDailyRoutines(MemberDailyRoutineListAcquireServiceRequest.of(memberId)));
return ResponseEntity.ok(success(SUCCESS_GET_ROUTINE.getMessage(), response));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineAchieveResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.request.MemberDailyRoutineCreateRequest;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineCreateResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineListGetResponse;
import com.soptie.server.memberRoutine.controller.v1.dto.response.MemberDailyRoutineListAcquireResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand Down Expand Up @@ -144,7 +144,7 @@ ResponseEntity<SuccessResponse<MemberDailyRoutineAchieveResponse>> achieveMember
)
}
)
ResponseEntity<SuccessResponse<MemberDailyRoutineListGetResponse>> getMemberDailyRoutines(
ResponseEntity<SuccessResponse<MemberDailyRoutineListAcquireResponse>> getMemberDailyRoutines(
@Parameter(hidden = true) Principal principal
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.soptie.server.memberRoutine.controller.v1.dto.response;

import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse.MemberDailyRoutineServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse.MemberDailyRoutineServiceResponse;
import lombok.Builder;
import lombok.NonNull;

Expand All @@ -10,12 +10,12 @@
import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record MemberDailyRoutineListGetResponse(
public record MemberDailyRoutineListAcquireResponse(
@NonNull List<MemberDailyRoutineResponse> routines
) {

public static MemberDailyRoutineListGetResponse of(MemberDailyRoutineGetServiceResponse response) {
return MemberDailyRoutineListGetResponse.builder()
public static MemberDailyRoutineListAcquireResponse of(MemberDailyRoutinesAcquireServiceResponse response) {
return MemberDailyRoutineListAcquireResponse.builder()
.routines(response.routines().stream().map(MemberDailyRoutineResponse::of).toList())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.soptie.server.common.dto.SuccessResponse;
import com.soptie.server.memberRoutine.controller.v2.api.MemberDailyRoutineApi;
import com.soptie.server.memberRoutine.controller.v2.dto.response.MemberDailyRoutineListGetResponseV2;
import com.soptie.server.memberRoutine.controller.v2.dto.response.MemberDailyRoutineListAcquireResponseV2;
import com.soptie.server.memberRoutine.service.MemberRoutineReadService;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListGetServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListAcquireServiceRequest;
import lombok.RequiredArgsConstructor;
import lombok.val;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,12 +25,12 @@ public class MemberDailyRoutineControllerV2 implements MemberDailyRoutineApi {
private final MemberRoutineReadService memberRoutineReadService;

@GetMapping
public ResponseEntity<SuccessResponse<MemberDailyRoutineListGetResponseV2>> acquireAll(
public ResponseEntity<SuccessResponse<MemberDailyRoutineListAcquireResponseV2>> acquireAll(
Principal principal
) {
val memberId = Long.parseLong(principal.getName());
val response = MemberDailyRoutineListGetResponseV2
.of(memberRoutineReadService.acquireAll(MemberDailyRoutineListGetServiceRequest.of(memberId)));
val response = MemberDailyRoutineListAcquireResponseV2
.of(memberRoutineReadService.acquireAll(MemberDailyRoutineListAcquireServiceRequest.of(memberId)));
return ResponseEntity.ok(success(SUCCESS_GET_ROUTINE.getMessage(), response));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.soptie.server.common.dto.ErrorResponse;
import com.soptie.server.common.dto.SuccessResponse;
import com.soptie.server.memberRoutine.controller.v2.dto.response.MemberDailyRoutineListGetResponseV2;
import com.soptie.server.memberRoutine.controller.v2.dto.response.MemberDailyRoutineListAcquireResponseV2;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
Expand Down Expand Up @@ -38,7 +38,7 @@ public interface MemberDailyRoutineApi {
)
}
)
ResponseEntity<SuccessResponse<MemberDailyRoutineListGetResponseV2>> acquireAll(
ResponseEntity<SuccessResponse<MemberDailyRoutineListAcquireResponseV2>> acquireAll(
@Parameter(hidden = true) Principal principal
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.soptie.server.memberRoutine.controller.v2.dto.response;

import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListAcquireServiceResponse;
import lombok.Builder;
import lombok.NonNull;

Expand All @@ -10,12 +10,12 @@
import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record MemberDailyRoutineListGetResponseV2(
public record MemberDailyRoutineListAcquireResponseV2(
@NonNull List<MemberDailyRoutineListResponse> routines
) {

public static MemberDailyRoutineListGetResponseV2 of(MemberDailyRoutineListGetServiceResponse response) {
return MemberDailyRoutineListGetResponseV2.builder()
public static MemberDailyRoutineListAcquireResponseV2 of(MemberDailyRoutineListAcquireServiceResponse response) {
return MemberDailyRoutineListAcquireResponseV2.builder()
.routines(response.routines().stream()
.map(MemberDailyRoutineListResponse::of)
.toList())
Expand All @@ -29,7 +29,7 @@ public record MemberDailyRoutineListResponse(
@NonNull List<MemberDailyRoutineResponse> routines
) {

public static MemberDailyRoutineListResponse of(MemberDailyRoutineGetServiceResponse routines) {
public static MemberDailyRoutineListResponse of(MemberDailyRoutinesAcquireServiceResponse routines) {
return MemberDailyRoutineListResponse.builder()
.themeId(routines.themeId())
.themeName(routines.themeName())
Expand All @@ -46,7 +46,7 @@ public record MemberDailyRoutineResponse(
) {

private static MemberDailyRoutineResponse of(
MemberDailyRoutineGetServiceResponse.MemberDailyRoutineServiceResponse routine
MemberDailyRoutinesAcquireServiceResponse.MemberDailyRoutineServiceResponse routine
) {
return MemberDailyRoutineResponse.builder()
.routineId(routine.routineId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.soptie.server.member.adapter.MemberFinder;
import com.soptie.server.memberRoutine.adapter.MemberRoutineFinder;
import com.soptie.server.memberRoutine.repository.dto.MemberRoutineResponse;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListGetServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberDailyRoutineListAcquireServiceRequest;
import com.soptie.server.memberRoutine.service.dto.request.MemberHappinessRoutineGetServiceRequest;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberHappinessRoutineGetServiceResponse;
import lombok.RequiredArgsConstructor;
import lombok.val;
Expand All @@ -25,10 +25,10 @@ public class MemberRoutineReadService {
private final MemberRoutineFinder memberRoutineFinder;
private final MemberFinder memberFinder;

public MemberDailyRoutineGetServiceResponse getDailyRoutines(MemberDailyRoutineListGetServiceRequest request) {
public MemberDailyRoutinesAcquireServiceResponse getDailyRoutines(MemberDailyRoutineListAcquireServiceRequest request) {
val member = memberFinder.findById(request.memberId());
val routines = memberRoutineFinder.findAllByMember(member);
return MemberDailyRoutineGetServiceResponse.of(routines);
return MemberDailyRoutinesAcquireServiceResponse.of(routines);
}

public Optional<MemberHappinessRoutineGetServiceResponse> getHappinessRoutine(
Expand All @@ -39,16 +39,16 @@ public Optional<MemberHappinessRoutineGetServiceResponse> getHappinessRoutine(
return memberRoutine.map(MemberHappinessRoutineGetServiceResponse::of);
}

public MemberDailyRoutineListGetServiceResponse acquireAll(MemberDailyRoutineListGetServiceRequest request) {
public MemberDailyRoutineListAcquireServiceResponse acquireAll(MemberDailyRoutineListAcquireServiceRequest request) {
val member = memberFinder.findById(request.memberId());
val routines = memberRoutineFinder.findAllByMember(member);
val routinesWithTheme = collectByTheme(routines);
return MemberDailyRoutineListGetServiceResponse.of(routinesWithTheme);
return MemberDailyRoutineListAcquireServiceResponse.of(routinesWithTheme);
}

private List<MemberDailyRoutineGetServiceResponse> collectByTheme(List<MemberRoutineResponse> routines) {
private List<MemberDailyRoutinesAcquireServiceResponse> collectByTheme(List<MemberRoutineResponse> routines) {
val routinesByTheme = routines.stream().collect(Collectors.groupingBy(MemberRoutineResponse::themeId));
return routinesByTheme.values().stream()
.map(MemberDailyRoutineGetServiceResponse::of).toList();
.map(MemberDailyRoutinesAcquireServiceResponse::of).toList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.soptie.server.memberRoutine.service.dto.request;

import lombok.Builder;

import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record MemberDailyRoutineListAcquireServiceRequest(
long memberId
) {

public static MemberDailyRoutineListAcquireServiceRequest of(long memberId) {
return MemberDailyRoutineListAcquireServiceRequest.builder()
.memberId(memberId)
.build();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.soptie.server.memberRoutine.service.dto.response;

import lombok.Builder;
import lombok.NonNull;

import java.util.List;

import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record MemberDailyRoutineListAcquireServiceResponse(
@NonNull List<MemberDailyRoutinesAcquireServiceResponse> routines
) {

public static MemberDailyRoutineListAcquireServiceResponse of(List<MemberDailyRoutinesAcquireServiceResponse> routines) {
return MemberDailyRoutineListAcquireServiceResponse.builder()
.routines(routines)
.build();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record MemberDailyRoutineGetServiceResponse(
public record MemberDailyRoutinesAcquireServiceResponse(
long themeId,
@NonNull String themeName,
@NonNull List<MemberDailyRoutineServiceResponse> routines
) {

public static MemberDailyRoutineGetServiceResponse of(List<MemberRoutineResponse> routines) {
return MemberDailyRoutineGetServiceResponse.builder()
public static MemberDailyRoutinesAcquireServiceResponse of(List<MemberRoutineResponse> routines) {
return MemberDailyRoutinesAcquireServiceResponse.builder()
.themeId(routines.get(0).themeId())
.themeName(routines.get(0).themeName())
.routines(routines.stream().map(MemberDailyRoutineServiceResponse::of).toList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import com.soptie.server.memberRoutine.service.MemberRoutineDeleteService;
import com.soptie.server.memberRoutine.service.MemberRoutineReadService;
import com.soptie.server.memberRoutine.service.dto.request.*;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineGetServiceResponse.MemberDailyRoutineServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListGetServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutinesAcquireServiceResponse.MemberDailyRoutineServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberDailyRoutineListAcquireServiceResponse;
import com.soptie.server.memberRoutine.service.dto.response.MemberHappinessRoutineGetServiceResponse;
import com.soptie.server.routine.entity.Challenge;
import com.soptie.server.routine.entity.Routine;
Expand Down Expand Up @@ -308,10 +308,10 @@ void getMemberDailyRoutinesByMember() {
memberRoutineRepository.save(MemberRoutineFixture.memberRoutine()
.member(member2).routineId(routine3.getId()).type(routine3.getType()).build());

MemberDailyRoutineListGetServiceRequest request = MemberDailyRoutineListGetServiceRequest.of(member1.getId());
MemberDailyRoutineListAcquireServiceRequest request = MemberDailyRoutineListAcquireServiceRequest.of(member1.getId());

// when
final MemberDailyRoutineGetServiceResponse actual = memberRoutineReadService.getDailyRoutines(request);
final MemberDailyRoutinesAcquireServiceResponse actual = memberRoutineReadService.getDailyRoutines(request);

// then
List<String> contents = actual.routines().stream().map(MemberDailyRoutineServiceResponse::content).toList();
Expand Down Expand Up @@ -353,16 +353,16 @@ void getMemberDailyRoutinesByMember() {
memberRoutineRepository.save(MemberRoutineFixture.memberRoutine()
.member(member).routineId(routine3.getId()).type(routine3.getType()).build());

MemberDailyRoutineListGetServiceRequest request = MemberDailyRoutineListGetServiceRequest.of(member.getId());
MemberDailyRoutineListAcquireServiceRequest request = MemberDailyRoutineListAcquireServiceRequest.of(member.getId());

// when
final MemberDailyRoutineListGetServiceResponse actual = memberRoutineReadService.acquireAll(request);
final MemberDailyRoutineListAcquireServiceResponse actual = memberRoutineReadService.acquireAll(request);

// then
int themeCount = actual.routines().size();
assertThat(themeCount).isEqualTo(2);
List<String> contents = actual.routines().get(0).routines().stream().map(
MemberDailyRoutineGetServiceResponse.MemberDailyRoutineServiceResponse::content).toList();
MemberDailyRoutinesAcquireServiceResponse.MemberDailyRoutineServiceResponse::content).toList();
assertThat(contents).hasSize(2);
assertThat(contents).containsExactly(routine2.getContent(), routine1.getContent());
}
Expand Down

0 comments on commit 641add7

Please sign in to comment.