Skip to content

Commit

Permalink
fix: kakao 로그인시 회원가입 여부 같이 반환하기
Browse files Browse the repository at this point in the history
  • Loading branch information
eckrin committed Nov 17, 2023
1 parent 0bf20f4 commit 66a500d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/main/generated/com/kusitms/jipbap/food/QFood.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ public class QFood extends EntityPathBase<Food> {

public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this);

public final NumberPath<Long> canadaPrice = createNumber("canadaPrice", Long.class);

public final QCategory category;

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final StringPath description = createString("description");

public final NumberPath<Long> dollarPrice = createNumber("dollarPrice", Long.class);

public final StringPath foodPackage = createString("foodPackage");

public final NumberPath<Long> id = createNumber("id", Long.class);

public final StringPath image = createString("image");

public final StringPath name = createString("name");

public final NumberPath<Long> price = createNumber("price", Long.class);

public final NumberPath<Long> recommendCount = createNumber("recommendCount", Long.class);

public final com.kusitms.jipbap.store.QStore store;
Expand Down
57 changes: 57 additions & 0 deletions src/main/generated/com/kusitms/jipbap/food/QFoodOption.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.kusitms.jipbap.food;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QFoodOption is a Querydsl query type for FoodOption
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QFoodOption extends EntityPathBase<FoodOption> {

private static final long serialVersionUID = -200977866L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QFoodOption foodOption = new QFoodOption("foodOption");

public final NumberPath<Long> canadaPrice = createNumber("canadaPrice", Long.class);

public final NumberPath<Long> dollarPrice = createNumber("dollarPrice", Long.class);

public final QFood food;

public final NumberPath<Long> id = createNumber("id", Long.class);

public final StringPath name = createString("name");

public QFoodOption(String variable) {
this(FoodOption.class, forVariable(variable), INITS);
}

public QFoodOption(Path<? extends FoodOption> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QFoodOption(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QFoodOption(PathMetadata metadata, PathInits inits) {
this(FoodOption.class, metadata, inits);
}

public QFoodOption(Class<? extends FoodOption> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.food = inits.isInitialized("food") ? new QFood(forProperty("food"), inits.get("food")) : null;
}

}

2 changes: 2 additions & 0 deletions src/main/generated/com/kusitms/jipbap/user/QUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class QUser extends EntityPathBase<User> {

public final StringPath address = createString("address");

public final EnumPath<CountryPhoneCode> countryPhoneCode = createEnum("countryPhoneCode", CountryPhoneCode.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/kusitms/jipbap/auth/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public CommonResponse<SignInResponseDto> signIn(@Valid @RequestBody SignInReques
@Operation(summary = "카카오 회원 가입(로그인)")
@PostMapping("/kakao")
@ResponseStatus(HttpStatus.OK)
public CommonResponse<SignInResponseDto> kakaoVerification(@RequestBody KakaoSignInRequestDto dto) {
public CommonResponse<KakaoSignInResponseDto> kakaoVerification(@RequestBody KakaoSignInRequestDto dto) {
return new CommonResponse<>(authService.kakaoAutoSignIn(authService.getKakaoProfile(dto.getToken())));
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/kusitms/jipbap/auth/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public KakaoProfileDto getKakaoProfile(String token) {
* @return
*/
@Transactional
public SignInResponseDto kakaoAutoSignIn(KakaoProfileDto profile) {
public KakaoSignInResponseDto kakaoAutoSignIn(KakaoProfileDto profile) {
boolean isSignUp = false;
User kakaoUser = User.builder()
.email(profile.getKakao_account().getEmail())
.username(profile.getProperties().getNickname())
Expand All @@ -145,6 +146,7 @@ public SignInResponseDto kakaoAutoSignIn(KakaoProfileDto profile) {

if(userRepository.findByEmail(kakaoUser.getEmail()).isEmpty()) {
log.info(profile.getKakao_account().getEmail()+": 기존 회원이 아니므로 자동 회원가입 후 로그인을 진행합니다.");
isSignUp = true;
signUp(new SignUpRequestDto(
kakaoUser.getEmail(),
kakaoUser.getPassword(),
Expand All @@ -160,7 +162,7 @@ public SignInResponseDto kakaoAutoSignIn(KakaoProfileDto profile) {

User findUser = userRepository.findByEmail(kakaoUser.getEmail()).orElseThrow(()->new UserNotFoundException("카카오 회원가입 도중 문제가 발생했습니다."));
findUser.updateOAuth(KAKAO);
return signIn(kakaoUser.getEmail(), kakaoUser.getPassword());
return new KakaoSignInResponseDto(signIn(kakaoUser.getEmail(), kakaoUser.getPassword()), isSignUp);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.kusitms.jipbap.auth.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class KakaoSignInResponseDto {
private SignInResponseDto dto;
private Boolean isSignUp;
}

0 comments on commit 66a500d

Please sign in to comment.