-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from WE-ARE-RACCOONS/RAC-110
RAC-110 refactor : 카카오 로그인 code로 변경
- Loading branch information
Showing
32 changed files
with
406 additions
and
56 deletions.
There are no files selected for viewing
10 changes: 4 additions & 6 deletions
10
...pplication/dto/req/KakaoLoginRequest.java → ...application/dto/req/KakaoCodeRequest.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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
package com.postgraduate.domain.auth.application.dto.req; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.*; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class KakaoLoginRequest { | ||
@Getter | ||
public class KakaoCodeRequest { | ||
@NotNull | ||
private String accessToken; | ||
private String code; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/postgraduate/domain/auth/application/dto/res/KakaoTokenInfoResponse.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,20 @@ | ||
package com.postgraduate.domain.auth.application.dto.res; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class KakaoTokenInfoResponse { | ||
private String access_token; | ||
private String token_type; | ||
private String refresh_token; | ||
private String id_token; | ||
private int expires_in; | ||
private String cope; | ||
private int refresh_token_expires_in; | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/postgraduate/domain/auth/exception/AuthException.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,9 @@ | ||
package com.postgraduate.domain.auth.exception; | ||
|
||
import com.postgraduate.global.exception.ApplicationException; | ||
|
||
public class AuthException extends ApplicationException { | ||
protected AuthException(String message, String errorCode) { | ||
super(message, errorCode); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/postgraduate/domain/auth/exception/PermissionDeniedException.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,12 @@ | ||
package com.postgraduate.domain.auth.exception; | ||
|
||
import static com.postgraduate.domain.auth.presentation.contant.AuthResponseCode.AUTH_NONE; | ||
import static com.postgraduate.domain.auth.presentation.contant.AuthResponseMessage.PERMISSION_DENIED_MESSAGE; | ||
|
||
|
||
public class PermissionDeniedException extends AuthException { | ||
|
||
public PermissionDeniedException() { | ||
super(PERMISSION_DENIED_MESSAGE.getMessage(), AUTH_NONE.getCode()); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
...ain/java/com/postgraduate/domain/mentoring/application/dto/req/MentoringApplyRequest.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,20 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.req; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MentoringApplyRequest { | ||
@NotNull | ||
private Long seniorId; | ||
@NotNull | ||
private String topic; | ||
@NotNull | ||
private String question; | ||
@NotNull | ||
private String date; | ||
} |
15 changes: 15 additions & 0 deletions
15
...in/java/com/postgraduate/domain/mentoring/application/dto/req/MentoringStatusRequest.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,15 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.req; | ||
|
||
import com.postgraduate.domain.mentoring.domain.entity.constant.Status; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MentoringStatusRequest { | ||
@NotNull | ||
private Status status; | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/dto/AppliedMentoringDetailResponse.java → ...o/res/AppliedMentoringDetailResponse.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
3 changes: 2 additions & 1 deletion
3
...ication/dto/AppliedMentoringResponse.java → ...ion/dto/res/AppliedMentoringResponse.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
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
33 changes: 33 additions & 0 deletions
33
...java/com/postgraduate/domain/mentoring/application/usecase/CheckIsMyMentoringUseCase.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,33 @@ | ||
package com.postgraduate.domain.mentoring.application.usecase; | ||
|
||
import com.postgraduate.domain.auth.exception.PermissionDeniedException; | ||
import com.postgraduate.domain.mentoring.domain.entity.Mentoring; | ||
import com.postgraduate.domain.mentoring.domain.service.MentoringGetService; | ||
import com.postgraduate.domain.senior.domain.entity.Senior; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class CheckIsMyMentoringUseCase { | ||
private final MentoringGetService mentoringGetService; | ||
public Mentoring checkByRole(User user, Long mentoringId) { | ||
Mentoring mentoring = mentoringGetService.byMentoringId(mentoringId); | ||
if (mentoring.getUser() != user) { | ||
throw new PermissionDeniedException(); | ||
} | ||
return mentoring; | ||
} | ||
|
||
public Mentoring checkByRole(Senior senior, Long mentoringId) { | ||
Mentoring mentoring = mentoringGetService.byMentoringId(mentoringId); | ||
if (mentoring.getSenior() != senior) { | ||
throw new PermissionDeniedException(); | ||
} | ||
return mentoring; | ||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
...ain/java/com/postgraduate/domain/mentoring/application/usecase/MentoringApplyUseCase.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,30 @@ | ||
package com.postgraduate.domain.mentoring.application.usecase; | ||
|
||
import com.postgraduate.domain.mentoring.application.dto.req.MentoringApplyRequest; | ||
import com.postgraduate.domain.mentoring.application.mapper.MentoringMapper; | ||
import com.postgraduate.domain.mentoring.domain.entity.Mentoring; | ||
import com.postgraduate.domain.mentoring.domain.service.MentoringSaveService; | ||
import com.postgraduate.domain.senior.domain.entity.Senior; | ||
import com.postgraduate.domain.senior.domain.service.SeniorGetService; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import com.postgraduate.global.auth.AuthDetails; | ||
import com.postgraduate.global.config.security.util.SecurityUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class MentoringApplyUseCase { | ||
private final SecurityUtils securityUtils; | ||
private final MentoringSaveService mentoringSaveService; | ||
private final SeniorGetService seniorGetService; | ||
|
||
public void applyMentoring(AuthDetails authDetails, MentoringApplyRequest request) { | ||
User user = securityUtils.getLoggedInUser(authDetails); | ||
Senior senior = seniorGetService.bySeniorId(request.getSeniorId()); | ||
Mentoring mentoring = MentoringMapper.mapToMentoring(user, senior, request); | ||
mentoringSaveService.save(mentoring); | ||
} | ||
} |
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
...in/java/com/postgraduate/domain/mentoring/application/usecase/MentoringManageUseCase.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 com.postgraduate.domain.mentoring.application.usecase; | ||
|
||
import com.postgraduate.domain.mentoring.application.dto.req.MentoringStatusRequest; | ||
import com.postgraduate.domain.mentoring.domain.entity.Mentoring; | ||
import com.postgraduate.domain.mentoring.domain.service.MentoringUpdateService; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import com.postgraduate.global.auth.AuthDetails; | ||
import com.postgraduate.global.config.security.util.SecurityUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class MentoringManageUseCase { | ||
private final SecurityUtils securityUtils; | ||
private final MentoringUpdateService mentoringUpdateService; | ||
private final CheckIsMyMentoringUseCase checkIsMyMentoringUseCase; | ||
|
||
public void updateStatus(AuthDetails authDetails, Long mentoringId, MentoringStatusRequest request) { | ||
User user = securityUtils.getLoggedInUser(authDetails); | ||
Mentoring mentoring = checkIsMyMentoringUseCase.checkByRole(user, mentoringId); | ||
mentoringUpdateService.updateStatus(mentoring, request.getStatus()); | ||
} | ||
} |
Oops, something went wrong.