-
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 branch 'main' into inpink/#10-to-main
- Loading branch information
Showing
5 changed files
with
60 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,9 @@ | |
### Response | ||
|
||
#### `Response Status 200 OK` | ||
|
||
``` json | ||
{ | ||
"id": "1234567890123" | ||
} | ||
``` |
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/kotlin/me/misik/api/api/response/ReviewResponse.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,18 @@ | ||
package me.misik.api.api.response | ||
|
||
import me.misik.api.domain.Review | ||
|
||
data class ReviewResponse( | ||
val isSuccess: Boolean, | ||
val id: String, | ||
val review: String, | ||
) { | ||
|
||
companion object { | ||
fun of(review: Review): ReviewResponse = ReviewResponse( | ||
isSuccess = review.isCompleted, | ||
id = review.id.toString(), | ||
review = review.text, | ||
) | ||
} | ||
} |
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,23 @@ | ||
package me.misik.api.app | ||
|
||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.coroutines.withTimeout | ||
import me.misik.api.core.GracefulShutdownDispatcher | ||
import me.misik.api.domain.Review | ||
import me.misik.api.domain.ReviewService | ||
import org.springframework.stereotype.Component | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
@Component | ||
class GetReviewFacade( | ||
private val reviewService: ReviewService, | ||
) { | ||
|
||
fun getReview(id: Long): Review { | ||
return runBlocking(GracefulShutdownDispatcher.dispatcher) { | ||
withTimeout(60.seconds) { | ||
reviewService.getReview(id) | ||
}.get() | ||
} | ||
} | ||
} |
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