Skip to content

Commit

Permalink
refactor: #4 dayoff, duty에 applyAt, processAt 칼럼 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
nyeJiiii committed Aug 2, 2023
1 parent 816a0cb commit b299a68
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@AllArgsConstructor
Expand All @@ -29,4 +30,6 @@ public class DayOff {
private DayOffType type; //연차(0), 오전반차(1), 오후반차(2)
private DayOffStatus status; //대기(0), 승인(1), 반려(2)
private Float numOfDayOff;
private LocalDate applyAt;
private LocalDate processAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ public static class RegisterDTO {
@NotNull
private String reason;

public DayOff toEntity(User user) {
public DayOff toEntity(User user, float numOfDayOff) {
return DayOff.builder()
.type(this.type)
.startDate(this.startDate)
.endDate(this.endDate)
.reason(this.reason)
.status(DayOffStatus.valueOf("대기"))
.applyAt(LocalDate.now())
.user(user)
.numOfDayOff(numOfDayOff)
.build();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/example/kdtbe5_miniproject/duty/Duty.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public class Duty {
private LocalDate date;
private String reason;
private DutyStatus status; //대기(0), 승인(1), 반려(2)
private LocalDate applyAt;
private LocalDate processAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ public static class DutyDTO {
private LocalDate date;
@NotEmpty
private String reason;
private LocalDate applyAt;

public Duty toEntity(User user) {
return Duty.builder()
.date(this.date)
.reason(this.reason)
.status(DutyStatus.valueOf("대기")) // 모르고 이부분을 안넣었습니다.
.status(DutyStatus.valueOf("대기"))
.applyAt(LocalDate.now())
.user(user)
.build();
}
Expand Down

0 comments on commit b299a68

Please sign in to comment.