Skip to content

Commit

Permalink
마일스톤 생성 오류 임시 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Miensoap committed May 22, 2024
1 parent 3cd026b commit 8c48035
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package team1.issuetracker.domain.milestone;

import java.util.Date;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.relational.core.conversion.DbActionExecutionException;
import org.springframework.stereotype.Service;
import team1.issuetracker.domain.Issue.Issue;
import team1.issuetracker.domain.milestone.dto.MilestoneInfo;
Expand Down Expand Up @@ -47,8 +45,18 @@ public MilestoneShowResponse getMilestoneAtIssue(Issue issue) {
}

public Milestone createMilestone(String name, String description, Date deadline, String userId) {
Milestone milestone = Milestone.builder().name(name).description(description).deadline(deadline).userId(userId).build();
return milestoneRepository.save(milestone);
Milestone milestone = Milestone.builder()
.name(name)
.description(description)
.deadline(deadline)
.userId(userId)
.issues(new HashSet<>())
.build();
try {
return milestoneRepository.save(milestone);
}catch (DbActionExecutionException failToCreate){
throw new IllegalArgumentException("마일스톤 제목은 중복될 수 없습니다! 다시 확인하세요!");
}
}

public void deleteMilestone(Long id, String userId) {
Expand Down

0 comments on commit 8c48035

Please sign in to comment.