generated from semicolondsm/Semicolon_Repository_Generator
-
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.
feat: add calling application API in SignUp Saga (#56)
- Loading branch information
1 parent
b98985e
commit 448f95b
Showing
10 changed files
with
81 additions
and
9 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
9 changes: 9 additions & 0 deletions
9
user-domain/src/main/kotlin/com/xquare/v1userservice/user/spi/SaveUserBaseApplicationSpi.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.xquare.v1userservice.user.spi | ||
|
||
import com.xquare.v1userservice.annotations.Spi | ||
import java.util.UUID | ||
|
||
@Spi | ||
interface SaveUserBaseApplicationSpi { | ||
suspend fun processStep(userId: UUID) | ||
} |
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
10 changes: 10 additions & 0 deletions
10
.../src/main/kotlin/com/xquare/v1userservice/application/properties/ApplicationProperties.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,10 @@ | ||
package com.xquare.v1userservice.application.properties | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.ConstructorBinding | ||
|
||
@ConstructorBinding | ||
@ConfigurationProperties(prefix = "service.application") | ||
class ApplicationProperties( | ||
val host: String | ||
) |
32 changes: 32 additions & 0 deletions
32
...cture/src/main/kotlin/com/xquare/v1userservice/user/spi/SaveUserBaseApplicationSpiImpl.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,32 @@ | ||
package com.xquare.v1userservice.user.spi | ||
|
||
import com.xquare.v1userservice.application.properties.ApplicationProperties | ||
import com.xquare.v1userservice.user.spi.dtos.SaveUserBaseApplicationRequest | ||
import java.util.UUID | ||
import org.springframework.stereotype.Repository | ||
import org.springframework.web.reactive.function.client.WebClient | ||
|
||
@Repository | ||
class SaveUserBaseApplicationSpiImpl( | ||
private val webClient: WebClient, | ||
private val applicationProperties: ApplicationProperties | ||
) : SaveUserBaseApplicationSpi { | ||
override suspend fun processStep(userId: UUID) { | ||
val baseApplicationRequest = buildBaseApplicationRequest(userId) | ||
|
||
sendPostApplicationDefaultValue(baseApplicationRequest) | ||
} | ||
|
||
private fun buildBaseApplicationRequest(userId: UUID) = | ||
SaveUserBaseApplicationRequest(userId) | ||
|
||
private fun sendPostApplicationDefaultValue(saveUserBaseApplicationRequest: SaveUserBaseApplicationRequest) = | ||
webClient.post() | ||
.uri { | ||
it.host(applicationProperties.host) | ||
.path("/applications/signup") | ||
.build() | ||
} | ||
.bodyValue(saveUserBaseApplicationRequest) | ||
.retrieve() | ||
} |
7 changes: 7 additions & 0 deletions
7
.../src/main/kotlin/com/xquare/v1userservice/user/spi/dtos/SaveUserBaseApplicationRequest.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.xquare.v1userservice.user.spi.dtos | ||
|
||
import java.util.UUID | ||
|
||
data class SaveUserBaseApplicationRequest( | ||
val userId: UUID | ||
) |
2 changes: 1 addition & 1 deletion
2
...erificationcode/VerificationCodeEntity.kt → ...erificationcode/VerificationCodeEntity.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
3 changes: 1 addition & 2 deletions
3
...cationcode/spi/VerificationCodeSpiImpl.kt → ...cationcode/spi/VerificationCodeSpiImpl.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
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