Skip to content

Commit

Permalink
🎨 SteadySearchResponse -> SteadyQueryResponse 로 네이밍 변경
Browse files Browse the repository at this point in the history
weonest committed Dec 26, 2023
1 parent 61b66aa commit 01cb055
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@
import dev.steady.steady.dto.response.PageResponse;
import dev.steady.steady.dto.response.ParticipantsResponse;
import dev.steady.steady.dto.response.SteadyDetailResponse;
import dev.steady.steady.dto.response.SteadyQueryResponse;
import dev.steady.steady.dto.response.SteadyQuestionsResponse;
import dev.steady.steady.dto.response.SteadySearchResponse;
import dev.steady.steady.service.SteadyService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
@@ -59,11 +59,11 @@ public ResponseEntity<SliceResponse<MySteadyResponse>> findMySteadies(@RequestPa
}

@GetMapping("/search")
public ResponseEntity<PageResponse<SteadySearchResponse>> getSteadies(@Auth(required = false) UserInfo userInfo,
SteadySearchRequest request) {
public ResponseEntity<PageResponse<SteadyQueryResponse>> getSteadies(@Auth(required = false) UserInfo userInfo,
SteadySearchRequest request) {
FilterConditionDto condition = FilterConditionDto.from(request);
Pageable pageable = request.toPageable();
PageResponse<SteadySearchResponse> response = steadyService.getSteadies(userInfo, condition, pageable);
PageResponse<SteadyQueryResponse> response = steadyService.getSteadies(userInfo, condition, pageable);
return ResponseEntity.ok(response);
}

Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
import java.time.LocalDateTime;
import java.util.List;

public record SteadySearchResponse(
public record SteadyQueryResponse(
Long id,
String nickname,
String profileImage,
@@ -18,27 +18,29 @@ public record SteadySearchResponse(
SteadyStatus status,
LocalDate deadline,
LocalDateTime createdAt,
LocalDateTime promotedAt,
int participantLimit,
int numberOfParticipants,
int viewCount,
int likeCount,
List<SteadyStackResponse> stacks
// TODO: 2023-10-25 해쉬태그, 조회수, 댓글 수
// TODO: 2023-10-25 해쉬태그, 댓글 수
) {

public static SteadySearchResponse from(Steady steady) {
public static SteadyQueryResponse from(Steady steady) {
User leader = steady.getParticipants().getLeader();
List<SteadyStackResponse> stacks = steady.getSteadyStacks().stream()
.map(SteadyStackResponse::from)
.toList();
return new SteadySearchResponse(steady.getId(),
return new SteadyQueryResponse(steady.getId(),
leader.getNickname(),
leader.getProfileImage(),
steady.getTitle(),
steady.getType(),
steady.getStatus(),
steady.getDeadline(),
steady.getCreatedAt(),
steady.getPromotion().getPromotedAt(),
steady.getParticipantLimit(),
steady.getNumberOfParticipants(),
steady.getViewCount(),
7 changes: 3 additions & 4 deletions src/main/java/dev/steady/steady/service/SteadyService.java
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@
import dev.steady.steady.dto.response.PageResponse;
import dev.steady.steady.dto.response.ParticipantsResponse;
import dev.steady.steady.dto.response.SteadyDetailResponse;
import dev.steady.steady.dto.response.SteadyQueryResponse;
import dev.steady.steady.dto.response.SteadyQuestionsResponse;
import dev.steady.steady.dto.response.SteadySearchResponse;
import dev.steady.user.domain.Position;
import dev.steady.user.domain.Stack;
import dev.steady.user.domain.User;
@@ -81,10 +81,9 @@ public Long create(SteadyCreateRequest request, UserInfo userinfo) {
}

@Transactional(readOnly = true)
public PageResponse<SteadySearchResponse> getSteadies(UserInfo userInfo, FilterConditionDto conditionDto, Pageable pageable) {
public PageResponse<SteadyQueryResponse> getSteadies(UserInfo userInfo, FilterConditionDto conditionDto, Pageable pageable) {
Page<Steady> steadies = steadyRepository.findAllByFilterCondition(userInfo, conditionDto, pageable);
Page<SteadySearchResponse> searchResponses = steadies
.map(SteadySearchResponse::from);
Page<SteadyQueryResponse> searchResponses = steadies.map(SteadyQueryResponse::from);
return PageResponse.from(searchResponses);
}

0 comments on commit 01cb055

Please sign in to comment.