Skip to content

Commit

Permalink
Merge pull request #32 from TEAM-Workit/feat/hyeonji/#31
Browse files Browse the repository at this point in the history
프로젝트 모아보기 상세조회, 역량 모아보기 상세조회 API responseBody의 work 형식 통일
  • Loading branch information
hyeon-z authored Mar 15, 2023
2 parents 1222f58 + 15c9da4 commit 08411b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package workit.dto.ability;

import lombok.Data;
import workit.dto.collection.CollectionDetailResponseDto;
import workit.dto.work.WorkResponseDto;

import java.util.List;

@Data
public class AllAbilityCollectionDetailResponseDto {
private String abilityName;
private List<CollectionDetailResponseDto> works;
private List<WorkResponseDto> works;

public AllAbilityCollectionDetailResponseDto(String abilityName, List<CollectionDetailResponseDto> works) {
public AllAbilityCollectionDetailResponseDto(String abilityName, List<WorkResponseDto> works) {
this.abilityName = abilityName;
this.works = works;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package workit.dto.project;

import lombok.Data;
import workit.dto.collection.CollectionDetailResponseDto;
import workit.dto.work.WorkResponseDto;

import java.util.List;

@Data
public class AllProjectCollectionDetailResponseDto {
private String projectTitle;
private List<CollectionDetailResponseDto> works;
private List<WorkResponseDto> works;

public AllProjectCollectionDetailResponseDto(String projectTitle, List<CollectionDetailResponseDto> works) {
public AllProjectCollectionDetailResponseDto(String projectTitle, List<WorkResponseDto> works) {
this.projectTitle = projectTitle;
this.works = works;
}
Expand Down
12 changes: 6 additions & 6 deletions workit/src/main/java/workit/service/ProjectService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import workit.dto.collection.CollectionDetailResponseDto;
import workit.dto.project.AllProjectCollectionDetailResponseDto;
import workit.dto.project.ProjectCollectionResponseDto;
import workit.dto.project.ProjectRequestDto;
import workit.dto.project.ProjectResponseDto;
import workit.dto.work.WorkResponseDto;
import workit.entity.Project;
import workit.entity.User;
import workit.entity.Work;
Expand Down Expand Up @@ -153,18 +153,18 @@ public List<ProjectCollectionResponseDto> getProjectCollection(Long userId) {
return responseDtos;
}

static List<CollectionDetailResponseDto> sortCollection(List<Work> works) {
List<CollectionDetailResponseDto> responseWorks = new ArrayList<>();
static List<WorkResponseDto> sortCollection(List<Work> works) {
List<WorkResponseDto> workResponseDtos = new ArrayList<>();

works.stream()
.sorted(Comparator.comparing(Work::getDate)
.thenComparing(Comparator.comparing(Work::getCreatedAt).reversed()))
.forEach(work -> {
CollectionDetailResponseDto responseDto = new CollectionDetailResponseDto(work);
responseWorks.add(responseDto);
WorkResponseDto workResponseDto = new WorkResponseDto(work);
workResponseDtos.add(workResponseDto);
});

return responseWorks;
return workResponseDtos;
}

static List<Date> stringToDateConverter(String start, String end) {
Expand Down

0 comments on commit 08411b6

Please sign in to comment.