Skip to content

Commit

Permalink
[BE-nathan] add: Card, Log domain 및 DTO 생성
Browse files Browse the repository at this point in the history
- Card와 Log domain Class
- Event, Section Enum
- CardDTO, LogDTO Class

Related to #5, #7
  • Loading branch information
nathan29849 committed Apr 8, 2022
1 parent 21ec011 commit 66a5944
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 0 deletions.
26 changes: 26 additions & 0 deletions backend/src/main/java/com/team05/todolist/domain/Card.java
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;
}

}
7 changes: 7 additions & 0 deletions backend/src/main/java/com/team05/todolist/domain/Event.java
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
}
21 changes: 21 additions & 0 deletions backend/src/main/java/com/team05/todolist/domain/Log.java
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 backend/src/main/java/com/team05/todolist/domain/Section.java
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 backend/src/main/java/com/team05/todolist/domain/dto/CardDTO.java
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 backend/src/main/java/com/team05/todolist/domain/dto/LogDTO.java
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;
}
}

0 comments on commit 66a5944

Please sign in to comment.