forked from codesquad-members-2022/todo-list
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE-nathan] add: Card, Log domain 및 DTO 생성
- Loading branch information
1 parent
21ec011
commit 66a5944
Showing
6 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
backend/src/main/java/com/team05/todolist/domain/Card.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.team05.todolist.domain; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class Card { | ||
|
||
private Integer id; | ||
private Integer orderIndex; | ||
private Integer delete; | ||
private String title; | ||
private String content; | ||
private Section section; | ||
|
||
public Card(Integer orderIndex, Integer delete, String title, String content, Section section) { | ||
this.orderIndex = orderIndex; | ||
this.delete = delete; | ||
this.title = title; | ||
this.content = content; | ||
this.section = section; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.team05.todolist.domain; | ||
|
||
public enum Event { | ||
CREATE, | ||
MOVE, | ||
DELETE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.team05.todolist.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class Log { | ||
|
||
private Integer id; | ||
private Event event; | ||
private LocalDateTime logTime; | ||
|
||
public Log(Event event, LocalDateTime logTime) { | ||
this.event = event; | ||
this.logTime = logTime; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/com/team05/todolist/domain/Section.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.team05.todolist.domain; | ||
|
||
public enum Section { | ||
TODO, | ||
DOING, | ||
DONE | ||
} |
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/com/team05/todolist/domain/dto/CardDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.team05.todolist.domain.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class CardDTO { | ||
|
||
private Integer cardId; | ||
private Integer orderIndex; | ||
private String title; | ||
private String content; | ||
|
||
public CardDTO(Integer cardId, Integer orderIndex, String title, String content) { | ||
this.cardId = cardId; | ||
this.orderIndex = orderIndex; | ||
this.title = title; | ||
this.content = content; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
backend/src/main/java/com/team05/todolist/domain/dto/LogDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.team05.todolist.domain.dto; | ||
|
||
import com.team05.todolist.domain.Event; | ||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class LogDTO { | ||
|
||
private Integer logId; | ||
private Event logEvent; | ||
private LocalDateTime logTime; | ||
|
||
public LogDTO(Integer logId, Event logEvent, LocalDateTime logTime) { | ||
this.logId = logId; | ||
this.logEvent = logEvent; | ||
this.logTime = checkDateTimeNull(logTime); | ||
} | ||
|
||
private LocalDateTime checkDateTimeNull(LocalDateTime logTime) { | ||
if (logTime == null) { | ||
return LocalDateTime.now(); | ||
} | ||
return logTime; | ||
} | ||
} |