Skip to content

Commit

Permalink
Merge pull request #39 from YAPP-Github/refactor/PC-425-common-module…
Browse files Browse the repository at this point in the history
…-split

[PC-000] 프로필 연락처 타입 수정
  • Loading branch information
Lujaec authored Feb 1, 2025
2 parents c4f953a + 0745d8e commit 0d6ecc6
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.yapp.core.auth.AuthenticationService;
import org.yapp.core.domain.match.MatchInfo;
import org.yapp.core.domain.match.enums.MatchStatus;
import org.yapp.core.domain.profile.ContactType;
import org.yapp.core.domain.profile.Profile;
import org.yapp.core.domain.profile.ProfileValuePick;
import org.yapp.core.domain.profile.ProfileValueTalk;
Expand Down Expand Up @@ -252,7 +253,7 @@ public void acceptMatch() {
}

@Transactional(readOnly = true)
public Map<String, String> getContacts() {
public Map<ContactType, String> getContacts() {
Long userId = authenticationService.getUserId();
MatchInfo matchInfo = getMatchInfo(userId);
if (!matchInfo.getUser1Accepted() || !matchInfo.getUser2Accepted()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yapp.core.domain.profile.ContactType;
import org.yapp.domain.block.application.DirectBlockService;
import org.yapp.domain.match.application.MatchService;
import org.yapp.domain.match.presentation.dto.response.ContactResponse;
Expand Down Expand Up @@ -90,7 +91,7 @@ public ResponseEntity<CommonResponse<Void>> acceptMatch() {
@GetMapping("/contacts")
@Operation(summary = "매칭 상대 연락처 조회", description = "매칭 상대의 연락처를 조회합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<ContactResponse>> getContacts() {
Map<String, String> contacts = matchService.getContacts();
Map<ContactType, String> contacts = matchService.getContacts();
ContactResponse contactResponse = new ContactResponse(contacts);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(contactResponse));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.yapp.core.domain.profile.ContactType;

@AllArgsConstructor
@NoArgsConstructor
@Getter
public class ContactResponse {

private Map<String, String> contacts;
private Map<ContactType, String> contacts;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.validation.constraints.Pattern;
import java.time.LocalDate;
import java.util.Map;
import org.yapp.core.domain.profile.ContactType;
import org.yapp.core.domain.profile.ProfileBasic;

public record ProfileBasicUpdateRequest(@NotBlank(message = "닉네임은 비어있을 수 없습니다.") String nickname,
Expand All @@ -21,7 +22,11 @@ public record ProfileBasicUpdateRequest(@NotBlank(message = "닉네임은 비어

@NotBlank(message = "위치는 비어있을 수 없습니다.") String location,

String smokingStatus, String snsActivityLevel,
@NotBlank(message = "흡연 정보는 비어있을 수 없습니다")
String smokingStatus,

@NotBlank(message = "SNS 활동 정보는 비어있을 수 없습니다.")
String snsActivityLevel,

@Min(value = 1, message = "몸무게는 최소 1kg 이상이어야 합니다.")
Integer weight,
Expand All @@ -32,7 +37,7 @@ public record ProfileBasicUpdateRequest(@NotBlank(message = "닉네임은 비어
@Pattern(regexp = "^https?://.*", message = "이미지 URL은 유효한 형식이어야 합니다.")
String imageUrl,

Map<String, String> contacts) {
Map<ContactType, String> contacts) {

public ProfileBasic toProfileBasic() {
return ProfileBasic.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import org.yapp.core.domain.profile.ContactType;

public record ProfileCreateRequest(

Expand Down Expand Up @@ -40,7 +41,7 @@ public record ProfileCreateRequest(
@Pattern(regexp = "^(활동|은둔)$", message = "SNS 활동 수준은 '활동', '은둔' 중 하나여야 합니다.")
String snsActivityLevel,

Map<String, String> contacts,
Map<ContactType, String> contacts,

@Pattern(regexp = "\\d{10,11}", message = "유효한 핸드폰 번호를 입력해야 합니다.")
String phoneNumber,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.yapp.domain.profile.presentation.response;

import java.util.Map;
import org.yapp.core.domain.profile.ContactType;
import org.yapp.core.domain.profile.Profile;
import org.yapp.core.domain.profile.ProfileBasic;
import org.yapp.domain.profile.application.util.DateUtils;
Expand All @@ -11,7 +12,7 @@ public record ProfileBasicResponse(String nickname, String description, int age,
String location,
String smokingStatus, Integer weight, String snsActivityLevel,
String imageUrl,
Map<String, String> contacts) {
Map<ContactType, String> contacts) {

public static ProfileBasicResponse from(Profile profile) {

Expand Down
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repositories {

subprojects {
bootJar.enabled = false
jar.enabled = true
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.yapp.core.domain.profile;

public enum ContactType {
KAKAO_TALK_ID,
OPEN_CHAT_URL,
INSTAGRAM_ID,
PHONE_NUMBER
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,12 @@ public class Profile extends BaseEntity {
@Embedded
private ProfileBasic profileBasic;

@Embedded
private ProfileBio profileBio;

@OneToMany(mappedBy = "profile", cascade = CascadeType.ALL, orphanRemoval = true)
private List<ProfileValueTalk> profileValueTalks;

@OneToMany(mappedBy = "profile", cascade = CascadeType.ALL, orphanRemoval = true)
private List<ProfileValuePick> profileValuePicks;

@Deprecated
public void updateBio(ProfileBio profileBio) {
this.profileBio = profileBio;
}

public void updateBasic(ProfileBasic profileBasic) {
this.profileBasic = profileBasic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ProfileBasic {

@Type(JsonType.class)
@Column(columnDefinition = "json")
private Map<String, String> contacts;
private Map<ContactType, String> contacts;

@Column(name = "image_url")
private String imageUrl;
Expand Down
9 changes: 9 additions & 0 deletions infra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ plugins {
group = 'org.yapp'
version = '0.0.1-SNAPSHOT'


bootJar.enabled = false
jar.enabled = true

subprojects {
bootJar.enabled = false
jar.enabled = true
}

repositories {
mavenCentral()
}
Expand Down

0 comments on commit 0d6ecc6

Please sign in to comment.