Skip to content

Commit

Permalink
refactor: CardUpdateDto, CardResponseDto 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
HaegyeongKim01 committed Nov 15, 2024
1 parent 2ec78f4 commit bf3d24a
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 6 deletions.
30 changes: 30 additions & 0 deletions src/main/java/com/devcard/devcard/card/dto/CardResponseDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ public class CardResponseDto {
private final String githubId;
private final String bio;
private final String profileImg;
private final String linkedin;
private final String notion;
private final String certification;
private final String extra;
private final boolean techStack;
private final boolean repository;
private final boolean contributions;
private final LocalDateTime createdAt;
private final LocalDateTime updatedAt;

public CardResponseDto(Long id, String name, String nickname, String company, String position, String email,
String phone, String githubId, String bio, String profileImg,
String linkedin, String notion, String certification, String extra,
boolean techStack, boolean repository, boolean contributions,
LocalDateTime createdAt, LocalDateTime updatedAt) {
this.id = id;
this.name = name;
Expand All @@ -35,6 +44,13 @@ public CardResponseDto(Long id, String name, String nickname, String company, St
this.githubId = githubId;
this.bio = bio;
this.profileImg = profileImg;
this.linkedin = linkedin;
this.notion = notion;
this.certification = certification;
this.extra = extra;
this.techStack = techStack;
this.repository = repository;
this.contributions = contributions;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
Expand All @@ -49,6 +65,13 @@ public CardResponseDto(Long id, String name, String nickname, String company, St
public String getGithubId() { return githubId; }
public String getBio() { return bio; }
public String getProfileImg() { return profileImg; }
public String getLinkedin() { return linkedin; }
public String getNotion() { return notion; }
public String getCertification() { return certification; }
public String getExtra() { return extra; }
public boolean isTechStack() { return techStack; }
public boolean isRepository() { return repository; }
public boolean isContributions() { return contributions; }
public LocalDateTime getCreatedAt() { return createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }

Expand All @@ -65,6 +88,13 @@ public static CardResponseDto fromEntity(Card card) {
member.getGithubId(),
card.getBio(),
member.getProfileImg(),
card.getLinkedin(),
card.getNotion(),
card.getCertification(),
card.getExtra(),
card.isTechStack(),
card.isRepository(),
card.isContributions(),
card.getCreatedAt(),
card.getUpdatedAt()
);
Expand Down
28 changes: 24 additions & 4 deletions src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,37 @@
public class CardUpdateDto {

private final String company;

private final String position;

private final String phone;
private final String bio;
private final String email;
private final String cardName;
private final String profileImg;
private final String linkedin;
private final String notion;
private final String certification;
private final String extra;
private final boolean techStack;
private final boolean repository;
private final boolean contributions;

public CardUpdateDto(String company, String position, String phone, String bio, String email, String cardName, String profileImg) {
public CardUpdateDto(String company, String position, String phone, String bio, String email, String cardName, String profileImg,
String linkedin, String notion, String certification, String extra,
boolean techStack, boolean repository, boolean contributions) {
this.company = company;
this.position = position;
this.phone = phone;
this.bio = bio;
this.email = email;
this.cardName = cardName;
this.profileImg = profileImg;
this.linkedin = linkedin;
this.notion = notion;
this.certification = certification;
this.extra = extra;
this.techStack = techStack;
this.repository = repository;
this.contributions = contributions;
}

public String getCompany() { return company; }
Expand All @@ -29,5 +43,11 @@ public CardUpdateDto(String company, String position, String phone, String bio,
public String getEmail() { return email; }
public String getCardName() { return cardName; }
public String getProfileImg() { return profileImg; }

public String getLinkedin() { return linkedin; }
public String getNotion() { return notion; }
public String getCertification() { return certification; }
public String getExtra() { return extra; }
public boolean isTechStack() { return techStack; }
public boolean isRepository() { return repository; }
public boolean isContributions() { return contributions; }
}
74 changes: 72 additions & 2 deletions src/main/java/com/devcard/devcard/card/entity/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ public class Card {
private String position;
private String phone;
private String bio;
private String linkedin;
private String notion;
private String certification;
private String extra;

private boolean techStack;
private boolean repository;
private boolean contributions;

private LocalDateTime createdAt;
private LocalDateTime updatedAt;

Expand All @@ -46,11 +55,17 @@ private Card(Builder builder) {
this.position = builder.position;
this.phone = builder.phone;
this.bio = builder.bio;
this.linkedin = builder.linkedin;
this.notion = builder.notion;
this.certification = builder.certification;
this.extra = builder.extra;
this.techStack = builder.techStack;
this.repository = builder.repository;
this.contributions = builder.contributions;
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}


// 빌더 패턴을 위한 생성자
public static class Builder {
private final Member member;
Expand All @@ -61,6 +76,13 @@ public static class Builder {
private String position;
private String phone;
private String bio;
private String linkedin;
private String notion;
private String certification;
private String extra;
private boolean techStack;
private boolean repository;
private boolean contributions;

public Builder(Member member) {
this.member = member;
Expand Down Expand Up @@ -101,6 +123,41 @@ public Builder bio(String bio) {
return this;
}

public Builder linkedin(String linkedin) {
this.linkedin = linkedin;
return this;
}

public Builder notion(String notion) {
this.notion = notion;
return this;
}

public Builder certification(String certification) {
this.certification = certification;
return this;
}

public Builder extra(String extra) {
this.extra = extra;
return this;
}

public Builder techStack(boolean techStack) {
this.techStack = techStack;
return this;
}

public Builder repository(boolean repository) {
this.repository = repository;
return this;
}

public Builder contributions(boolean contributions) {
this.contributions = contributions;
return this;
}

public Card build() {
return new Card(this);
}
Expand All @@ -116,6 +173,13 @@ public Card build() {
public String getPosition() { return position; }
public String getPhone() { return phone; }
public String getBio() { return bio; }
public String getLinkedin() { return linkedin; }
public String getNotion() { return notion; }
public String getCertification() { return certification; }
public String getExtra() { return extra; }
public boolean isTechStack() { return techStack; }
public boolean isRepository() { return repository; }
public boolean isContributions() { return contributions; }
public LocalDateTime getCreatedAt() { return createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }
public List<Group> getGroups() { return groups; }
Expand All @@ -133,7 +197,13 @@ public void updateFromDto(CardUpdateDto dto) {
this.email = dto.getEmail();
this.nickname = dto.getCardName();
this.profileImg = dto.getProfileImg();
this.linkedin = dto.getLinkedin();
this.notion = dto.getNotion();
this.certification = dto.getCertification();
this.extra = dto.getExtra();
this.techStack = dto.isTechStack();
this.repository = dto.isRepository();
this.contributions = dto.isContributions();
this.updatedAt = LocalDateTime.now();
}

}

0 comments on commit bf3d24a

Please sign in to comment.