Skip to content

Commit

Permalink
[MERGE/#160] 회원가입 시 반드시 필요한 필드들 NotNull 처리
Browse files Browse the repository at this point in the history
[FIX] #160 - 회원가입 시 반드시 필요한 필드들 NotNull 처리
  • Loading branch information
ckkim817 authored Nov 11, 2024
2 parents bec2ca8 + 8a17b8e commit f58c81c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
package org.sopt.seonyakServer.domain.member.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;

public record MemberJoinRequest(
@NotBlank(message = "role은 공백일 수 없습니다.")
String role,
@NotNull(message = "isSubscribed는 null일 수 없습니다.")
Boolean isSubscribed,
@NotBlank(message = "nickname은 공백일 수 없습니다.")
String nickname,
@NotNull(message = "image는 null일 수 없습니다.")
String image,
@NotBlank(message = "phoneNumber는 공백일 수 없습니다.")
String phoneNumber,
@NotBlank(message = "univName은 공백일 수 없습니다.")
String univName,
@NotBlank(message = "field는 공백일 수 없습니다.")
String field,
List<String> departmentList,
@NotEmpty(message = "departmentList는 비어 있을 수 없습니다.")
List<@NotBlank String> departmentList,
String businessCard,
String company,
String position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public record MemberJoinResponse(
Long seniorId,
String userType
String role
) {
public static MemberJoinResponse of(
final Long seniorId,
final String userType
final String role
) {
return new MemberJoinResponse(
seniorId,
userType
role
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ public void validNickname(final NicknameRequest nicknameRequest) {
public MemberJoinResponse patchMemberJoin(MemberJoinRequest memberJoinRequest) {
Member member = memberRepository.findMemberByIdOrThrow(principalHandler.getUserIdFromPrincipal());

String image = memberJoinRequest.image().isEmpty()
? (Math.random() < 0.5 ? "basic1.jpg" : "basic2.jpg")
: memberJoinRequest.image();

member.updateMember(
memberJoinRequest.isSubscribed(),
memberJoinRequest.nickname(),
"https://" + bucketName + s3Substring + "profiles/" + memberJoinRequest.image(),
"https://" + bucketName + s3Substring + "profiles/" + image,
memberJoinRequest.phoneNumber().replaceAll("-", ""),
memberJoinRequest.univName(),
memberJoinRequest.field(),
Expand Down

0 comments on commit f58c81c

Please sign in to comment.