-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
152 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ public ResponseEntity login( | |
memberService.verifiedNickname(request.nickname); | ||
|
||
// socialId, socialType기준 Member 반환, 없다면 새로 생성 | ||
Member member = memberService.getMemberBySocial(request.socialId, request.socialType); | ||
Member member = memberService.getMemberBySocial(request.socialId, request.socialType, "[email protected]"); | ||
|
||
// profile Url 설정 | ||
if (profileImage != null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/project/backend/domain/member/dto/MemberLoginDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package project.backend.domain.member.dto; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import lombok.*; | ||
import project.backend.domain.member.entity.SocialType; | ||
import project.backend.global.annotation.SocialTypeSubset; | ||
|
||
import javax.validation.constraints.Email; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class MemberLoginDto { | ||
@NotNull(message = "socialId는 필수값입니다.") | ||
public String socialId; | ||
|
||
@NotNull(message = "socialType은 필수값입니다.") | ||
@SocialTypeSubset(anyOf = {SocialType.KAKAO, SocialType.APPLE, SocialType.GOOGLE}, message = "KAKAO, APPLE, GOOGLE 중 하나를 입력해야 합니다.") | ||
public SocialType socialType; | ||
|
||
@Email(message = "유효한 이메일 형식을 입력해야 합니다.") | ||
public String email; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/project/backend/domain/member/dto/MemberRetrieveDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package project.backend.domain.member.dto; | ||
|
||
import lombok.*; | ||
import project.backend.domain.member.entity.Agree; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class MemberRetrieveDto { | ||
public Long id; | ||
public String email; | ||
public Boolean isSignup; | ||
public String accessToken; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/project/backend/global/annotation/SocialTypeSubset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package project.backend.global.annotation; | ||
|
||
import project.backend.domain.member.entity.SocialType; | ||
import project.backend.global.validator.SocialTypeSubsetValidator; | ||
|
||
import javax.validation.Constraint; | ||
import javax.validation.Payload; | ||
import java.lang.annotation.*; | ||
|
||
@Documented | ||
@Constraint(validatedBy = SocialTypeSubsetValidator.class) | ||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface SocialTypeSubset { | ||
SocialType[] anyOf(); | ||
String message() default "Invalid social type"; | ||
Class<?>[] groups() default {}; | ||
Class<? extends Payload>[] payload() default {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/project/backend/global/validator/SocialTypeSubsetValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package project.backend.global.validator; | ||
|
||
import project.backend.domain.member.entity.SocialType; | ||
import project.backend.global.annotation.SocialTypeSubset; | ||
|
||
import javax.validation.ConstraintValidator; | ||
import javax.validation.ConstraintValidatorContext; | ||
import java.util.Arrays; | ||
|
||
public class SocialTypeSubsetValidator implements ConstraintValidator<SocialTypeSubset, SocialType> { | ||
private SocialType[] subset; | ||
|
||
@Override | ||
public void initialize(SocialTypeSubset constraint) { | ||
this.subset = constraint.anyOf(); | ||
} | ||
|
||
@Override | ||
public boolean isValid(SocialType value, ConstraintValidatorContext context) { | ||
if (value == null) { | ||
return true; | ||
} | ||
return Arrays.asList(subset).contains(value); | ||
} | ||
} |