Skip to content

Commit

Permalink
[BE/#17] Feat : 도메인 클래스 생성 (User, Milestone, Issue)
Browse files Browse the repository at this point in the history
DB의 테이블과 같은 구성을 가진 도메인 클래스 생성
- User
- Milestone
- Issue
  • Loading branch information
MuseopKim committed Jun 11, 2020
1 parent 01390b8 commit 0f3d896
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 0 deletions.
124 changes: 124 additions & 0 deletions BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/Issue.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
126 changes: 126 additions & 0 deletions BE/src/main/java/com/codesquad/issuetracker/ragdoll/domain/User.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 0f3d896

Please sign in to comment.