#96 project comment added

This commit is contained in:
Васин Антон 2019-04-17 14:46:42 +03:00
parent 255692d6ea
commit e85c814f70
3 changed files with 30 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.deadline.model.Deadline; import ru.ulstu.deadline.model.Deadline;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -35,6 +36,9 @@ public class Project extends BaseEntity {
@Enumerated(value = EnumType.STRING) @Enumerated(value = EnumType.STRING)
private ProjectStatus status = ProjectStatus.APPLICATION; private ProjectStatus status = ProjectStatus.APPLICATION;
@NotNull
private String comment;
@OneToMany(cascade = CascadeType.ALL) @OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "project_id") @JoinColumn(name = "project_id")
private List<Deadline> deadlines = new ArrayList<>(); private List<Deadline> deadlines = new ArrayList<>();
@ -55,6 +59,14 @@ public class Project extends BaseEntity {
this.status = status; this.status = status;
} }
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public List<Deadline> getDeadlines() { public List<Deadline> getDeadlines() {
return deadlines; return deadlines;
} }

View File

@ -14,6 +14,7 @@ public class ProjectDto {
@NotEmpty @NotEmpty
private String title; private String title;
private Project.ProjectStatus status; private Project.ProjectStatus status;
private String comment;
private List<Deadline> deadlines = new ArrayList<>(); private List<Deadline> deadlines = new ArrayList<>();
public ProjectDto() { public ProjectDto() {
@ -27,10 +28,12 @@ public class ProjectDto {
public ProjectDto(@JsonProperty("id") Integer id, public ProjectDto(@JsonProperty("id") Integer id,
@JsonProperty("title") String title, @JsonProperty("title") String title,
@JsonProperty("status") Project.ProjectStatus status, @JsonProperty("status") Project.ProjectStatus status,
@JsonProperty("comment") String comment,
@JsonProperty("deadlines") List<Deadline> deadlines) { @JsonProperty("deadlines") List<Deadline> deadlines) {
this.id = id; this.id = id;
this.title = title; this.title = title;
this.status = status; this.status = status;
this.comment = comment;
this.deadlines = deadlines; this.deadlines = deadlines;
} }
@ -39,6 +42,7 @@ public class ProjectDto {
this.id = project.getId(); this.id = project.getId();
this.title = project.getTitle(); this.title = project.getTitle();
this.status = project.getStatus(); this.status = project.getStatus();
this.comment = project.getComment();
this.deadlines = project.getDeadlines(); this.deadlines = project.getDeadlines();
} }
@ -66,6 +70,14 @@ public class ProjectDto {
this.status = status; this.status = status;
} }
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public List<Deadline> getDeadlines() { public List<Deadline> getDeadlines() {
return deadlines; return deadlines;
} }

View File

@ -42,6 +42,12 @@
</option> </option>
</select> </select>
</div> </div>
<div class="form-group">
<label for="comment">Комментарий:</label>
<textarea class="form-control" rows="3" id="comment"
th:field="*{comment}"></textarea>
</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>