Skip to content

Commit

Permalink
Merge pull request #30 from potenday-project/feat/#24
Browse files Browse the repository at this point in the history
fix : project recommend schedule 수정
  • Loading branch information
oU-Ua authored Dec 16, 2023
2 parents 1c8cc62 + 8b68da6 commit 2055275
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ public ResponseEntity<List<String>> categoryRanking(){
}

@PostMapping("/create")
public ResponseEntity<Map<String, String>> insert(@RequestBody ProjectRequestDTO projectRequestDTO){
Map<String, String> result = new HashMap<>();
public ResponseEntity<Map<String, Long>> insert(@RequestBody ProjectRequestDTO projectRequestDTO){
Map<String, Long> result = new HashMap<>();

if (projectService.insert(projectRequestDTO).equals("success"))
result.put("message","프로젝트 생성이 완료되었습니다.");
else result.put("message", "알 수 없는 에러로 프로젝트를 생성하지 못했습니다. 잠시후 다시 시도해주세요.");

result.put("projectId",projectService.insert(projectRequestDTO));
return ResponseEntity.ok(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface ProjectService {
public List<ProjectResponseDTO> projectAll(Long userId);
public List<String> categoryRanking();

public String insert (ProjectRequestDTO projectRequestDTO);
public Long insert (ProjectRequestDTO projectRequestDTO);
public int progress(Long projectId);
public int dday (Long projectId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public List<String> categoryRanking() {
}
@Transactional
@Override
public String insert(ProjectRequestDTO projectRequestDTO) {
public Long insert(ProjectRequestDTO projectRequestDTO) {
try{
Project p = new Project();
Project project = p.mapToEntity(projectRequestDTO);
Expand All @@ -68,10 +68,10 @@ public String insert(ProjectRequestDTO projectRequestDTO) {
Member member = Member.builder().project(project).role(role).users(user).status(MemberStatus.PARTICIPATION).build();
memberRepository.save(member);
}
return "success";
return project.getProjectId();

}catch (Exception e){
return "error";
throw new UserException(ErrorCode.DUPLICATE_USER);
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/test/java/mvc/promiseme/project/projectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,19 @@ public void testInsert(){
List<MemberDTO> memberDTOList = new ArrayList<>();
memberDTOList.add(MemberDTO.builder().role("기획자").userId(1L).build());
memberDTOList.add(MemberDTO.builder().role("디자이너").userId(2L).build());
memberDTOList.add(MemberDTO.builder().role("프론트개발자").userId(1L).build());
memberDTOList.add(MemberDTO.builder().role("프론트 개발자").userId(3L).build());
memberDTOList.add(MemberDTO.builder().role("백엔드 개발자").userId(4L).build());
ProjectRequestDTO requestDTO = ProjectRequestDTO.builder()
.category("웹개발").
deadline(LocalDate.parse("2023-12-13"))
.name("약속해줘")
.start(LocalDate.parse("2023-12-13"))
deadline(LocalDate.parse("2023-12-17"))
.name("포텐데이")
.start(LocalDate.parse("2023-12-03"))
.memberList(memberDTOList).build();

System.out.println(projectService.insert(requestDTO));
}
@Test
public void testRecommendSchedule(){
recommendService.recommendSchedule(new RecommendScheduleRequestDTO("웹개발","기획자,백엔드개발자,프론트개발자,디자이너",LocalDate.parse("2023-10-13"),LocalDate.parse("2023-12-14")));
recommendService.recommendSchedule(new RecommendScheduleRequestDTO(8L,"웹개발","기획자,백엔드개발자,프론트개발자,디자이너",LocalDate.parse("2023-10-13"),LocalDate.parse("2023-12-14")));
}
}

0 comments on commit 2055275

Please sign in to comment.