-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: GET /users/me #91
Conversation
import org.springframework.web.bind.annotation.RestController | ||
import tw.waterballsa.gaas.application.usecases.GetUserUseCase | ||
import tw.waterballsa.gaas.domain.User | ||
|
||
@RestController | ||
@RequestMapping("/users") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent !!!
protected fun mockDefaultOidcUser(): OidcUser { | ||
return mockOidcUser(User(User.Id("1"), "[email protected]", "winner5566")) | ||
} | ||
|
||
protected fun mockOidcUser(mockUser: User): OidcUser { | ||
val idToken = OidcIdToken( | ||
"token", | ||
Instant.now(), | ||
Instant.now().plusSeconds(60), | ||
mapOf( | ||
"sub" to mockUser.id!!.value, | ||
"name" to mockUser.nickname, | ||
"email" to mockUser.email | ||
) | ||
) | ||
return DefaultOidcUser(emptyList(), idToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review done.
spring/src/test/kotlin/tw/waterballsa/gaas/spring/it/controllers/UserControllerTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
66c7d79
to
999c952
Compare
spring/src/main/kotlin/tw/waterballsa/gaas/spring/controllers/UserController.kt
Outdated
Show resolved
Hide resolved
bdaebd7
to
4ff10dd
Compare
4ff10dd
to
9aa2ded
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review done.
application/src/main/kotlin/tw/waterballsa/gaas/application/usecases/GetUserMeUseCase.kt
Outdated
Show resolved
Hide resolved
@@ -22,7 +22,7 @@ abstract class AbstractSpringBootTest { | |||
@Autowired | |||
private lateinit var objectMapper: ObjectMapper | |||
|
|||
protected final val mockUser: User = User( | |||
protected var mockUser: User = User( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q:為什麼需要 var?
spring/src/test/kotlin/tw/waterballsa/gaas/spring/it/controllers/UserControllerTest.kt
Outdated
Show resolved
Hide resolved
spring/src/test/kotlin/tw/waterballsa/gaas/spring/it/controllers/UserControllerTest.kt
Outdated
Show resolved
Hide resolved
spring/src/main/kotlin/tw/waterballsa/gaas/spring/controllers/UserController.kt
Outdated
Show resolved
Hide resolved
spring/src/main/kotlin/tw/waterballsa/gaas/spring/controllers/UserController.kt
Outdated
Show resolved
Hide resolved
spring/src/main/kotlin/tw/waterballsa/gaas/spring/controllers/UserController.kt
Outdated
Show resolved
Hide resolved
spring/src/test/kotlin/tw/waterballsa/gaas/spring/it/controllers/UserControllerTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Why need this change? / Root cause:
Changes made:
Test Scope / Change impact:
Issue
GET /users/me
#77