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: Point 조회 API 추가 및 BadRequest 수정
- Loading branch information
1 parent
4361bef
commit 156fed0
Showing
20 changed files
with
131 additions
and
28 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
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
7 changes: 7 additions & 0 deletions
7
user-domain/src/main/kotlin/com/xquare/v1userservice/user/api/dtos/PointDomainResponse.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.api.dtos | ||
|
||
data class PointDomainResponse( | ||
val userName: String, | ||
val goodPoint: Int, | ||
val badPoint: Int | ||
) |
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
user-domain/src/main/kotlin/com/xquare/v1userservice/user/spi/PointSpi.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.user.spi | ||
|
||
import com.xquare.v1userservice.annotations.Spi | ||
import com.xquare.v1userservice.user.spi.dtos.PointResponse | ||
import java.util.UUID | ||
|
||
@Spi | ||
interface PointSpi { | ||
suspend fun getUserPoint(userId: UUID): PointResponse | ||
} |
6 changes: 6 additions & 0 deletions
6
user-domain/src/main/kotlin/com/xquare/v1userservice/user/spi/dtos/PointResponse.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,6 @@ | ||
package com.xquare.v1userservice.user.spi.dtos | ||
|
||
data class PointResponse( | ||
val goodPoint: Int, | ||
val badPoint: Int | ||
) |
10 changes: 0 additions & 10 deletions
10
.../src/main/kotlin/com/xquare/v1userservice/application/properties/ApplicationProperties.kt
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...rservice/authority/AuthorityProperties.kt → ...nfiguration/property/ServiceProperties.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.xquare.v1userservice.authority | ||
package com.xquare.v1userservice.configuration.property | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.ConstructorBinding | ||
|
||
@ConstructorBinding | ||
@ConfigurationProperties(prefix = "service.authority") | ||
class AuthorityProperties( | ||
val host: String | ||
@ConfigurationProperties(prefix = "service") | ||
class ServiceProperties( | ||
val baseHost: String | ||
) |
8 changes: 8 additions & 0 deletions
8
...e/src/main/kotlin/com/xquare/v1userservice/user/exceptions/PointRequestFailedException.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,8 @@ | ||
package com.xquare.v1userservice.user.exceptions | ||
|
||
import com.xquare.v1userservice.exceptions.BaseException | ||
|
||
class PointRequestFailedException( | ||
message: String, | ||
statusCode: Int | ||
) : BaseException(message, statusCode) |
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
7 changes: 7 additions & 0 deletions
7
...tructure/src/main/kotlin/com/xquare/v1userservice/user/router/dto/GetUserPointResponse.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.router.dto | ||
|
||
data class GetUserPointResponse( | ||
val name: String, | ||
val goodPoint: Int, | ||
val badPoint: Int | ||
) |
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
35 changes: 35 additions & 0 deletions
35
user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/spi/PointSpiImpl.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,35 @@ | ||
package com.xquare.v1userservice.user.spi | ||
|
||
import com.xquare.v1userservice.configuration.property.ServiceProperties | ||
import com.xquare.v1userservice.user.exceptions.PointRequestFailedException | ||
import com.xquare.v1userservice.user.spi.dtos.PointResponse | ||
import com.xquare.v1userservice.user.spi.dtos.UserPointResponse | ||
import java.util.UUID | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.stereotype.Repository | ||
import org.springframework.web.reactive.function.client.WebClient | ||
import org.springframework.web.reactive.function.client.awaitBody | ||
|
||
@Repository | ||
class PointSpiImpl( | ||
private val webClient: WebClient, | ||
private val serviceProperties: ServiceProperties | ||
) : PointSpi { | ||
override suspend fun getUserPoint(userId: UUID): PointResponse { | ||
return webClient.get().uri { | ||
it.scheme("https") | ||
.host(serviceProperties.baseHost) | ||
.path("/point/{userId}") | ||
.build(userId) | ||
}.retrieve() | ||
.onStatus(HttpStatus::isError) { | ||
throw PointRequestFailedException("Failed request to get user point", it.rawStatusCode()) | ||
} | ||
.awaitBody<UserPointResponse>().let { | ||
PointResponse( | ||
goodPoint = it.goodPoint, | ||
badPoint = it.badPoint | ||
) | ||
} | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
...nfrastructure/src/main/kotlin/com/xquare/v1userservice/user/spi/dtos/UserPointResponse.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,6 @@ | ||
package com.xquare.v1userservice.user.spi.dtos | ||
|
||
data class UserPointResponse( | ||
val goodPoint: Int, | ||
val badPoint: Int | ||
) |