Skip to content

Commit

Permalink
Switched LocalDateTime type in "Schedule" entity to LocalDate.
Browse files Browse the repository at this point in the history
  • Loading branch information
FruTooTi committed Jan 2, 2024
1 parent c4b1e91 commit 2683d13
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

public class ScheduleDTO {
private Integer scheduleID;
@JsonFormat(pattern = "dd-MM-yyyy HH:mm")
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
private LocalDateTime beginningDate;
@JsonFormat(pattern = "dd-MM-yyyy")
@DateTimeFormat(pattern = "dd-MM-yyyy")
private LocalDate beginningDate;
private Integer doseFrequency;
private Integer doseCount;
public ScheduleDTO(){

}
public ScheduleDTO(Integer scheduleID, List<MedicationDTO> medications,
LocalDateTime beginningDate, Integer doseFrequency, Integer doseCount) {
LocalDate beginningDate, Integer doseFrequency, Integer doseCount) {
this.scheduleID = scheduleID;
this.beginningDate = beginningDate;
this.doseFrequency = doseFrequency;
Expand All @@ -33,11 +33,11 @@ public void setScheduleID(Integer scheduleID) {
this.scheduleID = scheduleID;
}

public LocalDateTime getBeginningDate() {
public LocalDate getBeginningDate() {
return beginningDate;
}

public void setBeginningDate(LocalDateTime beginningDate) {
public void setBeginningDate(LocalDate beginningDate) {
this.beginningDate = beginningDate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
import org.springframework.cglib.core.Local;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.Date;

public class CreateOrUpdateScheduleDTO {

@JsonFormat(pattern = "dd-MM-yyyy HH:mm")
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
private LocalDateTime beginningDate;
@JsonFormat(pattern = "dd-MM-yyyy")
@DateTimeFormat(pattern = "dd-MM-yyyy")
private LocalDate beginningDate;
private Integer doseFrequency;
private Integer doseCount;

public LocalDateTime getBeginningDate() {
public LocalDate getBeginningDate() {
return beginningDate;
}

public void setBeginningDate(LocalDateTime beginningDate) {
public void setBeginningDate(LocalDate beginningDate) {
this.beginningDate = beginningDate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.cglib.core.Local;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

Expand All @@ -19,10 +19,10 @@ public class Schedule {
private Integer ScheduleID;
@OneToMany(mappedBy = "ScheduleID", cascade = CascadeType.ALL)
private List<Medication> medications;
@JsonFormat(pattern = "dd-MM-yyyy HH:mm")
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
@JsonFormat(pattern = "dd-MM-yyyy")
@DateTimeFormat(pattern = "dd-MM-yyyy")
@Column(nullable = false)
private LocalDateTime beginningDate;
private LocalDate beginningDate;
@Column(nullable = false)
private Integer doseFrequency;
@Column(nullable = false)
Expand All @@ -34,10 +34,10 @@ public Integer getScheduleID() {
public void setScheduleID(Integer scheduleID) {
ScheduleID = scheduleID;
}
public LocalDateTime getBeginningDate() {
public LocalDate getBeginningDate() {
return beginningDate;
}
public void setBeginningDate(LocalDateTime beginningDate) {
public void setBeginningDate(LocalDate beginningDate) {
this.beginningDate = beginningDate;
}
public Integer getDoseFrequency() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void loadSeedToDatabase() {

//Create Schedule
Schedule exampleSchedule = new Schedule();
exampleSchedule.setBeginningDate(LocalDateTime.now());
exampleSchedule.setBeginningDate(LocalDate.now());
exampleSchedule.setDoseCount(1);
exampleSchedule.setDoseFrequency(1);

Expand Down

0 comments on commit 2683d13

Please sign in to comment.