#62 fix remove deadline in other JPA operation

This commit is contained in:
Anton Romanov 2019-04-13 22:59:59 +04:00
parent 9711febefb
commit 34499abd60
2 changed files with 1 additions and 3 deletions

View File

@ -60,6 +60,7 @@ public class ConferenceService {
public Integer update(ConferenceDto conferenceDto) throws IOException { public Integer update(ConferenceDto conferenceDto) throws IOException {
Conference conference = conferenceRepository.findOne(conferenceDto.getId()); Conference conference = conferenceRepository.findOne(conferenceDto.getId());
conferenceRepository.save(copyFromDto(conference, conferenceDto)); conferenceRepository.save(copyFromDto(conference, conferenceDto));
conferenceDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
return conference.getId(); return conference.getId();
} }
@ -74,8 +75,6 @@ public class ConferenceService {
conference.setPing(0); conference.setPing(0);
conference.setBeginDate(conferenceDto.getBeginDate()); conference.setBeginDate(conferenceDto.getBeginDate());
conference.setEndDate(conferenceDto.getEndDate()); conference.setEndDate(conferenceDto.getEndDate());
conferenceDto.getRemovedDeadlineIds()
.forEach(deadlineService::remove);
conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines())); conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));
return conference; return conference;
} }

View File

@ -45,6 +45,5 @@ public class DeadlineService {
@Transactional @Transactional
public void remove(Integer deadlineId) { public void remove(Integer deadlineId) {
deadlineRepository.delete(deadlineId); deadlineRepository.delete(deadlineId);
} }
} }