From 945dc18ef0e6df90648cc61a14279b91450fbc91 Mon Sep 17 00:00:00 2001 From: HaegyeongKim01 Date: Fri, 15 Nov 2024 14:13:21 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20=EB=AA=85=ED=95=A8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card/controller/rest/CardController.java | 5 +- .../devcard/card/dto/CardUpdateDto.java | 39 ++++++ .../com/devcard/devcard/card/entity/Card.java | 8 +- .../devcard/card/service/CardService.java | 5 +- .../resources/static/js/card/card-edit.js | 8 ++ src/main/resources/templates/card-create.html | 3 +- src/main/resources/templates/card-edit.html | 114 ++++++++++-------- 7 files changed, 124 insertions(+), 58 deletions(-) create mode 100644 src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java diff --git a/src/main/java/com/devcard/devcard/card/controller/rest/CardController.java b/src/main/java/com/devcard/devcard/card/controller/rest/CardController.java index 1a5ea9e..381293a 100644 --- a/src/main/java/com/devcard/devcard/card/controller/rest/CardController.java +++ b/src/main/java/com/devcard/devcard/card/controller/rest/CardController.java @@ -4,6 +4,7 @@ import com.devcard.devcard.auth.model.OauthMemberDetails; import com.devcard.devcard.card.dto.CardResponseDto; import com.devcard.devcard.card.dto.CardRequestDto; +import com.devcard.devcard.card.dto.CardUpdateDto; import com.devcard.devcard.card.service.CardService; import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; @@ -61,11 +62,11 @@ public ResponseEntity> getCards() { @PutMapping("/{id}") public ResponseEntity updateCard( @PathVariable Long id, - @Valid @RequestBody CardRequestDto cardRequestDto, + @Valid @RequestBody CardUpdateDto cardUpdateDto, @AuthenticationPrincipal OauthMemberDetails oauthMemberDetails) { Member member = oauthMemberDetails.getMember(); - CardResponseDto responseDto = cardService.updateCard(id, cardRequestDto, member); + CardResponseDto responseDto = cardService.updateCard(id, cardUpdateDto, member); return ResponseEntity.ok(responseDto); } diff --git a/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java new file mode 100644 index 0000000..bf7f334 --- /dev/null +++ b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java @@ -0,0 +1,39 @@ +package com.devcard.devcard.card.dto; + + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; + +public class CardUpdateDto { + + @NotBlank(message = "회사는 필수 입력 항목입니다.") + private final String company; + + private final String position; + + @Pattern(regexp = "^[+]?[0-9\\-\\s]+$", message = "유효한 전화번호 형식을 입력하세요.") + private final String phone; + private final String bio; + private final String email; + private final String cardName; + private final String profileImg; + + public CardUpdateDto(String company, String position, String phone, String bio, String email, String cardName, String profileImg) { + this.company = company; + this.position = position; + this.phone = phone; + this.bio = bio; + this.email = email; + this.cardName = cardName; + this.profileImg = profileImg; + } + + public String getCompany() { return company; } + public String getPosition() { return position; } + public String getPhone() { return phone; } + public String getBio() { return bio; } + public String getEmail() { return email; } + public String getCardName() { return cardName; } + public String getProfileImg() { return profileImg; } + +} diff --git a/src/main/java/com/devcard/devcard/card/entity/Card.java b/src/main/java/com/devcard/devcard/card/entity/Card.java index 9ebfedf..8b3a43a 100644 --- a/src/main/java/com/devcard/devcard/card/entity/Card.java +++ b/src/main/java/com/devcard/devcard/card/entity/Card.java @@ -1,7 +1,7 @@ package com.devcard.devcard.card.entity; import com.devcard.devcard.auth.entity.Member; -import com.devcard.devcard.card.dto.CardRequestDto; +import com.devcard.devcard.card.dto.CardUpdateDto; import jakarta.persistence.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -125,11 +125,15 @@ public void setGroups(List groups) { } // DTO 기반 업데이트 메서드 - public void updateFromDto(CardRequestDto dto) { + public void updateFromDto(CardUpdateDto dto) { if (dto.getCompany() != null) this.company = dto.getCompany(); if (dto.getPosition() != null) this.position = dto.getPosition(); if (dto.getPhone() != null) this.phone = dto.getPhone(); if (dto.getBio() != null) this.bio = dto.getBio(); + if (dto.getEmail() != null) this.email = dto.getEmail(); + if (dto.getCardName() != null) this.nickname = dto.getCardName(); + if (dto.getProfileImg() != null) this.profileImg = dto.getProfileImg(); this.updatedAt = LocalDateTime.now(); } + } diff --git a/src/main/java/com/devcard/devcard/card/service/CardService.java b/src/main/java/com/devcard/devcard/card/service/CardService.java index 0ef0a14..5a2dfb9 100644 --- a/src/main/java/com/devcard/devcard/card/service/CardService.java +++ b/src/main/java/com/devcard/devcard/card/service/CardService.java @@ -3,6 +3,7 @@ import com.devcard.devcard.auth.entity.Member; import com.devcard.devcard.card.dto.CardRequestDto; import com.devcard.devcard.card.dto.CardResponseDto; +import com.devcard.devcard.card.dto.CardUpdateDto; import com.devcard.devcard.card.entity.Group; import com.devcard.devcard.card.exception.CardNotFoundException; import com.devcard.devcard.card.repository.CardRepository; @@ -76,7 +77,7 @@ public List getCards() { } @Transactional - public CardResponseDto updateCard(Long id, CardRequestDto cardRequestDto, Member member) { + public CardResponseDto updateCard(Long id, CardUpdateDto cardUpdateDto, Member member) { Card existingCard = cardRepository.findById(id) .orElseThrow(() -> new CardNotFoundException("해당 명함을 찾을 수 없습니다.")); @@ -86,7 +87,7 @@ public CardResponseDto updateCard(Long id, CardRequestDto cardRequestDto, Member } // 기존 엔티티의 필드 업데이트 - existingCard.updateFromDto(cardRequestDto); + existingCard.updateFromDto(cardUpdateDto); return CardResponseDto.fromEntity(existingCard); } diff --git a/src/main/resources/static/js/card/card-edit.js b/src/main/resources/static/js/card/card-edit.js index 1169228..8811871 100644 --- a/src/main/resources/static/js/card/card-edit.js +++ b/src/main/resources/static/js/card/card-edit.js @@ -13,6 +13,9 @@ document.addEventListener("DOMContentLoaded", function() { document.getElementById("company").value = data.company; document.getElementById("position").value = data.position; document.getElementById("phone").value = data.phone; + document.getElementById("cardName").value = data.nickname || data.name; + document.getElementById("email").value = data.email; + document.getElementById("profileImg").value = data.profileImg; document.getElementById("bio").value = data.bio; }) .catch(error => { @@ -28,8 +31,12 @@ document.addEventListener("DOMContentLoaded", function() { company: document.getElementById("company").value, position: document.getElementById("position").value, phone: document.getElementById("phone").value, + cardName: document.getElementById("cardName").value, + email: document.getElementById("email").value, + profileImg: document.getElementById("profileImg").value, bio: document.getElementById("bio").value, }; + console.log(cardId); fetch(`/cards/${cardId}`, { method: "PUT", @@ -39,6 +46,7 @@ document.addEventListener("DOMContentLoaded", function() { body: JSON.stringify(updatedData) }) .then(response => { + console.log(response); if (response.ok) { handleSuccess("명함이 성공적으로 수정되었습니다!", 3000); setTimeout(() => { diff --git a/src/main/resources/templates/card-create.html b/src/main/resources/templates/card-create.html index 702bc0e..62b65eb 100644 --- a/src/main/resources/templates/card-create.html +++ b/src/main/resources/templates/card-create.html @@ -57,8 +57,7 @@

명함 생성

- - +
diff --git a/src/main/resources/templates/card-edit.html b/src/main/resources/templates/card-edit.html index a63f168..41667dd 100644 --- a/src/main/resources/templates/card-edit.html +++ b/src/main/resources/templates/card-edit.html @@ -1,50 +1,64 @@ - - - - - - 명함 수정 - - - - - - - - - -
-

명함 수정

-
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
- - -
- - -
- - - - + + + + + + 명함 수정 + + + + + + + + +
+ arrow_back_ios +

명함 수정

+
+ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+ + +
+ + + + From d66ef865ee121e906d732e3396afe62ed19b2cdd Mon Sep 17 00:00:00 2001 From: HaegyeongKim01 Date: Fri, 15 Nov 2024 14:17:34 +0900 Subject: [PATCH 2/5] =?UTF-8?q?refactor:=20=EA=B3=B5=EB=B0=B1=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/card/card-edit.js | 14 +++++++------- src/main/resources/templates/card-edit.html | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/resources/static/js/card/card-edit.js b/src/main/resources/static/js/card/card-edit.js index 8811871..9228504 100644 --- a/src/main/resources/static/js/card/card-edit.js +++ b/src/main/resources/static/js/card/card-edit.js @@ -10,13 +10,13 @@ document.addEventListener("DOMContentLoaded", function() { }) .then(response => response.json()) .then(data => { - document.getElementById("company").value = data.company; - document.getElementById("position").value = data.position; - document.getElementById("phone").value = data.phone; - document.getElementById("cardName").value = data.nickname || data.name; - document.getElementById("email").value = data.email; - document.getElementById("profileImg").value = data.profileImg; - document.getElementById("bio").value = data.bio; + document.getElementById("company").value = data.company || ""; + document.getElementById("position").value = data.position || ""; + document.getElementById("phone").value = data.phone || ""; + document.getElementById("cardName").value = data.nickname || data.name || ""; // 둘 다 없으면 빈 값 + document.getElementById("email").value = data.email || ""; + document.getElementById("profileImg").value = data.profileImg || ""; + document.getElementById("bio").value = data.bio || ""; }) .catch(error => { console.error("명함 데이터 로딩 실패:", error); diff --git a/src/main/resources/templates/card-edit.html b/src/main/resources/templates/card-edit.html index 41667dd..73ac039 100644 --- a/src/main/resources/templates/card-edit.html +++ b/src/main/resources/templates/card-edit.html @@ -6,6 +6,7 @@ 명함 수정 + From aac7b094bc0cb6bea3f1f53117ea9912ee15d95f Mon Sep 17 00:00:00 2001 From: HaegyeongKim01 Date: Fri, 15 Nov 2024 14:25:11 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20=EC=A7=81=EC=9E=A5=20=EB=93=B1?= =?UTF-8?q?=20=ED=95=84=EC=88=98=20=ED=95=84=EB=93=9C=C2=A0=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devcard/devcard/card/dto/CardUpdateDto.java | 6 ------ .../java/com/devcard/devcard/card/entity/Card.java | 14 +++++++------- src/main/resources/templates/card-edit.html | 6 +++--- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java index bf7f334..0ae40e2 100644 --- a/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java +++ b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java @@ -1,17 +1,11 @@ package com.devcard.devcard.card.dto; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Pattern; - public class CardUpdateDto { - @NotBlank(message = "회사는 필수 입력 항목입니다.") private final String company; private final String position; - @Pattern(regexp = "^[+]?[0-9\\-\\s]+$", message = "유효한 전화번호 형식을 입력하세요.") private final String phone; private final String bio; private final String email; diff --git a/src/main/java/com/devcard/devcard/card/entity/Card.java b/src/main/java/com/devcard/devcard/card/entity/Card.java index 8b3a43a..fd6cd34 100644 --- a/src/main/java/com/devcard/devcard/card/entity/Card.java +++ b/src/main/java/com/devcard/devcard/card/entity/Card.java @@ -126,13 +126,13 @@ public void setGroups(List groups) { // DTO 기반 업데이트 메서드 public void updateFromDto(CardUpdateDto dto) { - if (dto.getCompany() != null) this.company = dto.getCompany(); - if (dto.getPosition() != null) this.position = dto.getPosition(); - if (dto.getPhone() != null) this.phone = dto.getPhone(); - if (dto.getBio() != null) this.bio = dto.getBio(); - if (dto.getEmail() != null) this.email = dto.getEmail(); - if (dto.getCardName() != null) this.nickname = dto.getCardName(); - if (dto.getProfileImg() != null) this.profileImg = dto.getProfileImg(); + this.company = dto.getCompany(); + this.position = dto.getPosition(); + this.phone = dto.getPhone(); + this.bio = dto.getBio(); + this.email = dto.getEmail(); + this.nickname = dto.getCardName(); + this.profileImg = dto.getProfileImg(); this.updatedAt = LocalDateTime.now(); } diff --git a/src/main/resources/templates/card-edit.html b/src/main/resources/templates/card-edit.html index 73ac039..94d53cd 100644 --- a/src/main/resources/templates/card-edit.html +++ b/src/main/resources/templates/card-edit.html @@ -23,15 +23,15 @@

명함 수정

- +
- +
- +
From 2ec78f47845eb6d794215c7b29e65960870cd2f3 Mon Sep 17 00:00:00 2001 From: HaegyeongKim01 Date: Fri, 15 Nov 2024 14:51:33 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20=EB=AA=85=ED=95=A8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=99=94=EB=A9=B4=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F?= =?UTF-8?q?=20=EB=AA=85=ED=95=A8=C2=A0UI=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/css/card/card.css | 85 ++++++++++++++----- .../resources/static/js/card/card-edit.js | 20 ++++- src/main/resources/static/js/card/card.js | 11 ++- src/main/resources/templates/card-edit.html | 42 ++++++++- 4 files changed, 127 insertions(+), 31 deletions(-) diff --git a/src/main/resources/static/css/card/card.css b/src/main/resources/static/css/card/card.css index f652916..c273abe 100644 --- a/src/main/resources/static/css/card/card.css +++ b/src/main/resources/static/css/card/card.css @@ -4,62 +4,105 @@ align-items: center; justify-content: space-between; flex-direction: row-reverse; - background-color: #2c3e50; /* 다크 블루-그레이 배경 */ - color: #ecf0f1; /* 밝은 텍스트 색상 */ + background-color: #2c3e50; /* Dark blue-gray background */ + color: #ecf0f1; /* Light text color */ border-radius: 15px; padding: 20px; - margin: 10px; - width: 90%; - max-width: 600px; + margin: 10px auto; /* Small margin around the card */ + width: 95%; /* Nearly full width of the screen */ + max-width: 500px; box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15); transition: transform 0.2s ease, box-shadow 0.2s ease; - cursor: pointer; /* 클릭 가능 아이콘 */ + cursor: pointer; + word-wrap: break-word; + overflow: hidden; } .card:hover { - transform: scale(1.02); /* 마우스 호버 시 크기 살짝 증가 */ - box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); /* 호버 시 그림자 강화 */ + transform: scale(1.02); + box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); } .card-image img { - width: 100px; - height: 100px; + width: 80px; + height: 80px; border-radius: 50%; object-fit: cover; - margin-top: -10px; + margin: 0 15px 0 0; } .card-content { flex: 1; - padding-right: 20px; + padding-right: 10px; } .card-content h3 { - font-size: 1.6rem; - margin-bottom: 12px; - color: #ffffff; /* 순수 흰색 텍스트 */ + font-size: 1.4rem; + margin-bottom: 8px; + color: #ffffff; + word-break: break-word; } .card-content p { - margin-bottom: 10px; + margin-bottom: 6px; display: flex; align-items: center; - font-size: 1rem; + font-size: 0.9rem; + line-height: 1.2; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; } .card-content p::before { - content: '•'; /* 각 줄 앞에 점을 추가 */ - color: #3498db; /* 블루 점 */ + content: '•'; + color: #3498db; margin-right: 8px; + font-size: 1.2rem; } .card-content a { - color: #1abc9c; /* 민트색 링크 */ + color: #1abc9c; text-decoration: none; font-weight: bold; + word-break: break-word; } .card-content a:hover { - color: #16a085; /* 조금 더 어두운 민트색으로 호버 효과 */ + color: #16a085; text-decoration: underline; } + +/* Responsive styling for smaller screens */ +@media (max-width: 600px) { + .card { + width: 95%; + padding: 15px; + } + + .card-image img { + width: 70px; + height: 70px; + margin: 0 auto 15px auto; + } + + .card-content { + padding: 0; + } + + .card-content h3 { + font-size: 1.2rem; + text-align: center; + } + + .card-content p { + font-size: 0.9rem; + text-align: center; + } + + .card-content a { + display: block; + word-break: break-word; + text-align: center; + } +} diff --git a/src/main/resources/static/js/card/card-edit.js b/src/main/resources/static/js/card/card-edit.js index 9228504..db9c3ce 100644 --- a/src/main/resources/static/js/card/card-edit.js +++ b/src/main/resources/static/js/card/card-edit.js @@ -1,4 +1,4 @@ -document.addEventListener("DOMContentLoaded", function() { +document.addEventListener("DOMContentLoaded", function () { const cardId = window.location.pathname.split("/")[2]; // 기존 데이터 가져오기 @@ -17,6 +17,13 @@ document.addEventListener("DOMContentLoaded", function() { document.getElementById("email").value = data.email || ""; document.getElementById("profileImg").value = data.profileImg || ""; document.getElementById("bio").value = data.bio || ""; + document.getElementById("linkedin").value = data.linkedin || ""; + document.getElementById("notion").value = data.notion || ""; + document.getElementById("certification").value = data.certification || ""; + document.getElementById("extra").value = data.extra || ""; + document.getElementById("techStack").checked = data.techStack || false; + document.getElementById("repository").checked = data.repository || false; + document.getElementById("contributions").checked = data.contributions || false; }) .catch(error => { console.error("명함 데이터 로딩 실패:", error); @@ -24,7 +31,7 @@ document.addEventListener("DOMContentLoaded", function() { }); // 수정하기 버튼 클릭 시 - document.getElementById("card-edit-form").addEventListener("submit", function(e) { + document.getElementById("card-edit-form").addEventListener("submit", function (e) { e.preventDefault(); const updatedData = { @@ -35,8 +42,14 @@ document.addEventListener("DOMContentLoaded", function() { email: document.getElementById("email").value, profileImg: document.getElementById("profileImg").value, bio: document.getElementById("bio").value, + linkedin: document.getElementById("linkedin").value, + notion: document.getElementById("notion").value, + certification: document.getElementById("certification").value, + extra: document.getElementById("extra").value, + techStack: document.getElementById("techStack").checked, + repository: document.getElementById("repository").checked, + contributions: document.getElementById("contributions").checked, }; - console.log(cardId); fetch(`/cards/${cardId}`, { method: "PUT", @@ -46,7 +59,6 @@ document.addEventListener("DOMContentLoaded", function() { body: JSON.stringify(updatedData) }) .then(response => { - console.log(response); if (response.ok) { handleSuccess("명함이 성공적으로 수정되었습니다!", 3000); setTimeout(() => { diff --git a/src/main/resources/static/js/card/card.js b/src/main/resources/static/js/card/card.js index a740455..24eb88a 100644 --- a/src/main/resources/static/js/card/card.js +++ b/src/main/resources/static/js/card/card.js @@ -1,5 +1,3 @@ -// card.js -// 카드 섹션을 채우는 함수 function populateCardSection(data, container) { if (data) { const githubUsername = data.name || data.nickname; @@ -25,7 +23,14 @@ function populateCardSection(data, container) {

${data.email ? `

📧 Email: ${data.email}

` : ''} + ${data.linkedin ? `

🔗 LinkedIn ${data.linkedin}

` : ''} + ${data.notion ? `

📚 Notion ${data.notion}

` : ''} + ${data.certification ? `

📜 Certification: ${data.certification}

` : ''} + ${data.extra ? `

📝 Extra: ${data.extra}

` : ''} ${data.bio ? `

📝 Bio: ${data.bio}

` : ''} + ${data.techStack ? `

✅ Tech Stack Included

` : ''} + ${data.repository ? `

✅ Repository Included

` : ''} + ${data.contributions ? `

✅ Contributions Included

` : ''}
`; @@ -55,4 +60,4 @@ function fetchCardData(cardId, container) { .then(response => response.json()) .then(data => populateCardSection(data, container)) .catch(error => console.error('Error fetching card data:', error)); -} +} \ No newline at end of file diff --git a/src/main/resources/templates/card-edit.html b/src/main/resources/templates/card-edit.html index 94d53cd..98c8485 100644 --- a/src/main/resources/templates/card-edit.html +++ b/src/main/resources/templates/card-edit.html @@ -23,15 +23,15 @@

명함 수정

- +
- +
- +
@@ -49,6 +49,42 @@

명함 수정

+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+

GitHub 추가 설정

+
+ + +
+
+ + +
+
+ + +
+
+
From bf3d24a4365abaa28020efee12a2487b2d5c2c6b Mon Sep 17 00:00:00 2001 From: HaegyeongKim01 Date: Fri, 15 Nov 2024 14:52:44 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20CardUpdateDto,=20CardResponseDt?= =?UTF-8?q?o=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devcard/card/dto/CardResponseDto.java | 30 ++++++++ .../devcard/card/dto/CardUpdateDto.java | 28 ++++++- .../com/devcard/devcard/card/entity/Card.java | 74 ++++++++++++++++++- 3 files changed, 126 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/devcard/devcard/card/dto/CardResponseDto.java b/src/main/java/com/devcard/devcard/card/dto/CardResponseDto.java index db9e882..5328e26 100644 --- a/src/main/java/com/devcard/devcard/card/dto/CardResponseDto.java +++ b/src/main/java/com/devcard/devcard/card/dto/CardResponseDto.java @@ -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; @@ -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; } @@ -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; } @@ -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() ); diff --git a/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java index 0ae40e2..50aac85 100644 --- a/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java +++ b/src/main/java/com/devcard/devcard/card/dto/CardUpdateDto.java @@ -3,16 +3,23 @@ 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; @@ -20,6 +27,13 @@ public CardUpdateDto(String company, String position, String phone, String 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; } @@ -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; } } diff --git a/src/main/java/com/devcard/devcard/card/entity/Card.java b/src/main/java/com/devcard/devcard/card/entity/Card.java index fd6cd34..cc19645 100644 --- a/src/main/java/com/devcard/devcard/card/entity/Card.java +++ b/src/main/java/com/devcard/devcard/card/entity/Card.java @@ -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; @@ -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; @@ -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; @@ -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); } @@ -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 getGroups() { return groups; } @@ -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(); } - }