Skip to content
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

實作取得房間資訊 #124

Merged
merged 1 commit into from
Jul 29, 2023
Merged

實作取得房間資訊 #124

merged 1 commit into from
Jul 29, 2023

Conversation

ted791029
Copy link
Contributor

@ted791029 ted791029 commented Jul 12, 2023

Why need this change? / Root cause:

  • A user want to get room information

Changes made:

  • Room related

Test Scope / Change impact:

  • RoomController

Issue

with(request) {
val room = findRoomById(Room.Id(roomId))!!
room.validatePlayerInRoom(Player.Id(userId))
room.also { presenter.present(it) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊可以直接 presenter.present(room)

Copy link
Collaborator

@Wally5077 Wally5077 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review done.

@ted791029 ted791029 force-pushed the feature/get-room branch 2 times, most recently from 236c8c0 to 588ac54 Compare July 16, 2023 13:58

private fun Room.validatePlayerInRoom(playerId: Player.Id) {
if (!hasPlayer(playerId)) {
throw PlatformException("Player(" + playerId!!.value + ") is not in the room(" + roomId!!.value + ").")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 String interpolate

val host = createUser("2", "test2@mail.com", "winner1122").toRoomPlayer()
givenHostAndPlayersJoinedTheRoom(host)
.whenUserGetTheRoom(userA)
.thenShouldFail("Player(" + userA.id!!.value + ") is not in the room(" + testRoom.roomId!!.value + ").")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto
使用 String interpolate

Copy link
Collaborator

@Wally5077 Wally5077 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review done.

Copy link
Collaborator

@Wally5077 Wally5077 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

依據jwt subject is user identity修正
根據第三次 code review 修正
根據第二次 code review 修正
根據第一次 code review 修正
實作取得房間資訊
@sonarcloud
Copy link

sonarcloud bot commented Jul 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ricksu978 ricksu978 merged commit d5a1af0 into main Jul 29, 2023
5 checks passed
@ricksu978 ricksu978 deleted the feature/get-room branch July 29, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET /rooms/{roomId} 取得房間資訊
4 participants