Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,20 @@ else if (dto.isDeleteImage()) // 팀 프로젝트 사진 삭제를 요청한 경
return ResponseEntity.status(500).body(Map.of("code", 500, "data", "팀 프로젝트 수정 오류. 잠시 후 다시 시도해주세요."));
}
}

@PatchMapping("/start/{projectId}")
public ResponseEntity<Map<String, Object>> startProject(@AuthenticationPrincipal UserEntity userInfo, @PathVariable Long projectId) {
try {
if(!myTeamService.isMyProject(projectId, userInfo))
throw new IllegalArgumentException("내가 생성한 프로젝트가 아님");

myTeamService.updateStart(projectId);

return org.springframework.http.ResponseEntity.ok().body(Map.of("code", 200, "data", true));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(Map.of("code", 400, "data", e.getMessage()));
} catch (RuntimeException e) {
return ResponseEntity.status(500).body(Map.of("code", 500, "data", "MY 팀플 로딩 오류. 잠시 후 다시 시도해주세요."));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,15 @@ else if(dto.isDeleteImage())

teamRepo.save(project);
}

public void updateStart(final Long projectId) {
final ProjectEntity project = teamRepo.findById(projectId).get();

if(!project.isStart())
project.setStart(true);
else
throw new IllegalArgumentException("이미 시작한 프로젝트");

teamRepo.save(project);
}
}