-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge :: 구글 연동 해제 & 리프레시 에러 해결 (#344)
- Loading branch information
Showing
9 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/seugi/api/domain/oauth/adapter/in/controller/GoogleRemoveController.kt
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,22 @@ | ||
package com.seugi.api.domain.oauth.adapter.`in`.controller | ||
|
||
import com.seugi.api.domain.oauth.port.`in`.GoogleRemoveUseCase | ||
import com.seugi.api.global.common.annotation.GetAuthenticatedId | ||
import com.seugi.api.global.response.BaseResponse | ||
import org.springframework.web.bind.annotation.DeleteMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/oauth/google") | ||
class GoogleRemoveController ( | ||
private val service: GoogleRemoveUseCase | ||
) { | ||
|
||
@DeleteMapping("/remove") | ||
fun remove(@GetAuthenticatedId userId: Long): BaseResponse<Unit> { | ||
service.remove(userId) | ||
return BaseResponse(message = "삭제 성공 !") | ||
} | ||
|
||
} |
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
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/seugi/api/domain/oauth/application/service/GoogleRemoveService.kt
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,27 @@ | ||
package com.seugi.api.domain.oauth.application.service | ||
|
||
import com.seugi.api.domain.oauth.application.exception.OAuthErrorCode | ||
import com.seugi.api.domain.oauth.port.`in`.GoogleRemoveUseCase | ||
import com.seugi.api.domain.oauth.port.out.DeleteOAuthPort | ||
import com.seugi.api.domain.oauth.port.out.ExistOAuthPort | ||
import com.seugi.api.global.auth.oauth.enums.Provider | ||
import com.seugi.api.global.exception.CustomException | ||
import jakarta.transaction.Transactional | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class GoogleRemoveService ( | ||
private val existOAuthPort: ExistOAuthPort, | ||
private val deleteOAuthPort: DeleteOAuthPort | ||
) : GoogleRemoveUseCase { | ||
|
||
@Transactional | ||
override fun remove(userId: Long) { | ||
if (!existOAuthPort.existOAuthByMemberIdAndProvider(userId, Provider.GOOGLE)) { | ||
throw CustomException(OAuthErrorCode.OAUTH_NOT_FOUND) | ||
} | ||
|
||
deleteOAuthPort.deleteOAuth(userId, Provider.GOOGLE) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/seugi/api/domain/oauth/port/in/GoogleRemoveUseCase.kt
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,7 @@ | ||
package com.seugi.api.domain.oauth.port.`in` | ||
|
||
interface GoogleRemoveUseCase { | ||
|
||
fun remove(userId: Long) | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/seugi/api/domain/oauth/port/out/DeleteOAuthPort.kt
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.seugi.api.domain.oauth.port.out | ||
|
||
import com.seugi.api.global.auth.oauth.enums.Provider | ||
|
||
interface DeleteOAuthPort { | ||
|
||
fun deleteOAuth(memberId: Long, provider: Provider) | ||
|
||
} |