From 0f3d8963645e2b940babd47f0b1ab77b6e58353c Mon Sep 17 00:00:00 2001 From: ragdoll Date: Fri, 12 Jun 2020 05:45:59 +0900 Subject: [PATCH] =?UTF-8?q?[BE/#17]=20Feat=20:=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?(User,=20Milestone,=20Issue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DB의 테이블과 같은 구성을 가진 도메인 클래스 생성 - User - Milestone - Issue --- .../issuetracker/ragdoll/domain/Issue.java | 124 +++++++++++++++++ .../ragdoll/domain/Milestone.java | 127 ++++++++++++++++++ .../issuetracker/ragdoll/domain/User.java | 126 +++++++++++++++++ 3 files changed, 377 insertions(+) create mode 100644 BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Issue.java create mode 100644 BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Milestone.java create mode 100644 BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/User.java diff --git a/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Issue.java b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Issue.java new file mode 100644 index 0000000..47767a5 --- /dev/null +++ b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Issue.java @@ -0,0 +1,124 @@ +package com.codesquad.issuetracker.ragdoll.domain; + +import java.time.LocalDateTime; + +public class Issue { + + private Long id; + + private String title; + + private LocalDateTime createdDateTime; + + private boolean opened; + + private Long userId; + + private Integer milestoneId; + + public Issue() {} + + private Issue(Long id, String title, LocalDateTime createdDateTime, boolean opened, Long userId, Integer milestoneId) { + this.id = id; + this.title = title; + this.createdDateTime = createdDateTime; + this.opened = opened; + this.userId = userId; + this.milestoneId = milestoneId; + } + + public static Issue create(Long id, String title, LocalDateTime createdDateTime, boolean opened, Long userId, Integer milestoneId) { + return new Issue(id, title, createdDateTime, opened, userId, milestoneId); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public boolean isOpened() { + return opened; + } + + public void setOpened(boolean opened) { + this.opened = opened; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Integer getMilestoneId() { + return milestoneId; + } + + public void setMilestoneId(Integer milestoneId) { + this.milestoneId = milestoneId; + } + + public static class Builder { + private Long id; + private String title; + private LocalDateTime createdDateTime; + private boolean opened; + private Long userId; + private Integer milestoneId; + + public Builder id(Long id) { + this.id = id; + return this; + } + + public Builder title(String title) { + this.title = title; + return this; + } + + public Builder createdDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + public Builder opened(boolean opened) { + this.opened = opened; + return this; + } + + public Builder userId(Long userId) { + this.userId = userId; + return this; + } + + public Builder milestoneId(Integer milestoneId) { + this.milestoneId = milestoneId; + return this; + } + + public Issue build() { + return new Issue(id, title, createdDateTime, opened, userId, milestoneId); + } + } +} diff --git a/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Milestone.java b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Milestone.java new file mode 100644 index 0000000..7d14b34 --- /dev/null +++ b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Milestone.java @@ -0,0 +1,127 @@ +package com.codesquad.issuetracker.ragdoll.domain; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class Milestone { + + private Integer id; + + private String title; + + private String description; + + private LocalDate dueDate; + + private LocalDateTime createdDateTime; + + private LocalDateTime updatedDateTime; + + public Milestone() {} + + private Milestone(Integer id, String title, String description, LocalDate dueDate, LocalDateTime createdDateTime, LocalDateTime updatedDateTime) { + this.id = id; + this.title = title; + this.description = description; + this.dueDate = dueDate; + this.createdDateTime = createdDateTime; + this.updatedDateTime = updatedDateTime; + } + + public static Milestone create(Integer id, String title, String description, LocalDate dueDate, LocalDateTime createdDateTime, LocalDateTime updatedDateTime) { + return new Milestone(id, title, description, dueDate, createdDateTime, updatedDateTime); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public LocalDate getDueDate() { + return dueDate; + } + + public void setDueDate(LocalDate dueDate) { + this.dueDate = dueDate; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public LocalDateTime getUpdatedDateTime() { + return updatedDateTime; + } + + public void setUpdatedDateTime(LocalDateTime updatedDateTime) { + this.updatedDateTime = updatedDateTime; + } + + public static class Builder { + private Integer id; + private String title; + private String description; + private LocalDate dueDate; + private LocalDateTime createdDateTime; + private LocalDateTime updatedDateTime; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder title(String title) { + this.title = title; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder dueDate(LocalDate dueDate) { + this.dueDate = dueDate; + return this; + } + + public Builder createdDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + public Builder updatedDateTime(LocalDateTime updatedDateTime) { + this.updatedDateTime = updatedDateTime; + return this; + } + + public Milestone build() { + return new Milestone(id, title, description, dueDate, createdDateTime, updatedDateTime); + } + } +} diff --git a/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/User.java b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/User.java new file mode 100644 index 0000000..25286e0 --- /dev/null +++ b/BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/User.java @@ -0,0 +1,126 @@ +package com.codesquad.issuetracker.ragdoll.domain; + +import java.time.LocalDateTime; + +public class User { + + private Long id; + + private String name; + + private String email; + + private Integer githubId; + + private String avatarUrl; + + private LocalDateTime createdDateTime; + + public User () {} + + private User(Long id, String name, String email, Integer githubId, String avatarUrl, LocalDateTime createdDateTime) { + this.id = id; + this.name = name; + this.email = email; + this.githubId = githubId; + this.avatarUrl = avatarUrl; + this.createdDateTime = createdDateTime; + } + + public static User create(Long id, String name, String email, Integer githubId, String avatarUrl, LocalDateTime createdDateTime) { + return new User(id, name, email, githubId, avatarUrl, createdDateTime); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getGithubId() { + return githubId; + } + + public void setGithubId(Integer githubId) { + this.githubId = githubId; + } + + public String getAvatarUrl() { + return avatarUrl; + } + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public static class Builder { + private Long id; + private String name; + private String email; + private Integer githubId; + private String avatarUrl; + private LocalDateTime createdDateTime; + + public Builder() {} + + public Builder id(Long id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder githubId(Integer githubId) { + this.githubId = githubId; + return this; + } + + public Builder avatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + return this; + } + + public Builder createdDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + public User build() { + return new User(id, name, email, githubId, avatarUrl, createdDateTime); + } + } +}