#55 fixed adding to DB

This commit is contained in:
Nightblade73 2019-04-06 11:05:30 +04:00
parent eb524d49d0
commit 926cd02096
2 changed files with 9 additions and 2 deletions

View File

@ -3,10 +3,13 @@ package ru.ulstu.conference.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.paper.model.PaperDto;
import ru.ulstu.user.model.UserDto;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
@ -26,7 +29,11 @@ public class ConferenceDto {
@Size(max = 255)
private String url;
private int ping;
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date beginDate;
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
@NotEmpty
private List<Deadline> deadlines = new ArrayList<>();

View File

@ -72,8 +72,8 @@ public class ConferenceService {
conference.setDescription(conferenceDto.getDescription());
conference.setUrl(conferenceDto.getUrl());
conference.setPing(0);
conference.setBeginDate(conference.getBeginDate());
conference.setEndDate(conference.getEndDate());
conference.setBeginDate(conferenceDto.getBeginDate());
conference.setEndDate(conferenceDto.getEndDate());
conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));