-
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 #134 from Guzzing/fix/profile
[Fix/profile] 프로필 이미지 리팩토링
- Loading branch information
Showing
39 changed files
with
448 additions
and
249 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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/guzzing/studayserver/domain/auth/listener/WithdrawAuthTokenListener.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,34 @@ | ||
package org.guzzing.studayserver.domain.auth.listener; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import org.guzzing.studayserver.domain.auth.jwt.AuthToken; | ||
import org.guzzing.studayserver.domain.auth.jwt.AuthTokenProvider; | ||
import org.guzzing.studayserver.domain.auth.jwt.JwtHeaderUtil; | ||
import org.guzzing.studayserver.domain.auth.service.AuthService; | ||
import org.guzzing.studayserver.domain.member.event.WithdrawEvent; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Component | ||
public class WithdrawAuthTokenListener { | ||
|
||
private final AuthService authService; | ||
private final AuthTokenProvider authTokenProvider; | ||
|
||
public WithdrawAuthTokenListener(AuthService authService, AuthTokenProvider authTokenProvider) { | ||
this.authService = authService; | ||
this.authTokenProvider = authTokenProvider; | ||
} | ||
|
||
@Async | ||
@TransactionalEventListener | ||
public void withdrawAuthToken(WithdrawEvent event) { | ||
HttpServletRequest request = event.getRequest(); | ||
String accessToken = JwtHeaderUtil.getAccessToken(request); | ||
AuthToken authToken = authTokenProvider.convertAuthToken(accessToken); | ||
|
||
authService.logout(authToken); | ||
} | ||
|
||
} |
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
24 changes: 24 additions & 0 deletions
24
...ain/java/org/guzzing/studayserver/domain/child/listener/WithdrawProfileImageListener.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,24 @@ | ||
package org.guzzing.studayserver.domain.child.listener; | ||
|
||
import org.guzzing.studayserver.domain.member.event.WithdrawEvent; | ||
import org.guzzing.studayserver.global.profile.ProfileImageService; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Component | ||
public class WithdrawProfileImageListener { | ||
|
||
private final ProfileImageService profileImageService; | ||
|
||
public WithdrawProfileImageListener(ProfileImageService profileImageService) { | ||
this.profileImageService = profileImageService; | ||
} | ||
|
||
@Async | ||
@TransactionalEventListener | ||
public void withdrawProfileImage(WithdrawEvent event) { | ||
event.getChildProfileImageUris() | ||
.forEach(profileImageService::deleteProfileImage); | ||
} | ||
} |
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
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
18 changes: 18 additions & 0 deletions
18
src/main/java/org/guzzing/studayserver/domain/member/event/WithdrawEvent.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,18 @@ | ||
package org.guzzing.studayserver.domain.member.event; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class WithdrawEvent { | ||
|
||
private final HttpServletRequest request; | ||
private final List<String> childProfileImageUris; | ||
|
||
public WithdrawEvent(HttpServletRequest request, List<String> childProfileImageUris) { | ||
this.request = request; | ||
this.childProfileImageUris = childProfileImageUris; | ||
} | ||
|
||
} |
Oops, something went wrong.