Skip to content
Snippets Groups Projects
Commit 5c4baa83 authored by Lukáš Majdan's avatar Lukáš Majdan Committed by Karolína Dočkalová Burská
Browse files

Add variable createdAt to training definition

parent f6513975
No related branches found
No related tags found
1 merge request!127Develop
......@@ -71,6 +71,8 @@ public class TrainingDefinition implements Serializable {
private LocalDateTime lastEdited;
@Column(name = "last_edited_by", nullable = false)
private String lastEditedBy;
@Column(name = "created_at", nullable = false)
private LocalDateTime createdAt;
/**
......@@ -294,6 +296,22 @@ public class TrainingDefinition implements Serializable {
this.lastEditedBy = lastEditedBy;
}
/**
* Gets the time the Training Definition was created at
* @return the time of Training Definition creation
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* Sets the creation time of the Training Definition
* @param createdAt time of Training Definition creation
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
@Override
public int hashCode() {
return Objects.hash(description, outcomes, prerequisites, state, title);
......@@ -327,6 +345,7 @@ public class TrainingDefinition implements Serializable {
", showStepperBar=" + this.isShowStepperBar() +
", estimatedDuration=" + this.getEstimatedDuration() +
", lastEdited=" + this.getLastEdited() +
", createdAt=" + this.getCreatedAt() +
'}';
}
}
......@@ -42,6 +42,8 @@ public class TrainingDefinitionDTO {
private LocalDateTime lastEdited;
@ApiModelProperty(value = "Name of the user who has done the last edit in definition.", example = "John Doe")
private String lastEditedBy;
@ApiModelProperty(value = "Time of creation of definition.", example = "2017-10-19 10:23:54+02")
private LocalDateTime createdAt;
/**
* Gets id.
......@@ -241,6 +243,21 @@ public class TrainingDefinitionDTO {
this.lastEditedBy = lastEditedBy;
}
/**
* Gets the time the Training Definition was created at
* @return the time of Training Definition creation
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* Sets the creation time of the Training Definition
* @param createdAt time of Training Definition creation
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
@Override
public String toString() {
return "TrainingDefinitionDTO{" +
......@@ -254,6 +271,7 @@ public class TrainingDefinitionDTO {
", canBeArchived=" + canBeArchived +
", estimatedDuration=" + estimatedDuration +
", lastEdited=" + lastEdited +
", createdAt=" + createdAt +
'}';
}
......
......@@ -314,6 +314,7 @@ public class TrainingDefinitionService {
public TrainingDefinition auditAndSave(TrainingDefinition trainingDefinition) {
trainingDefinition.setLastEdited(getCurrentTimeInUTC());
trainingDefinition.setLastEditedBy(userManagementServiceApi.getUserRefDTO().getUserRefFullName());
trainingDefinition.setCreatedAt(getCurrentTimeInUTC());
return trainingDefinitionRepository.save(trainingDefinition);
}
......
alter table training_definition add column created_at timestamp not null;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment