Skip to content

Commit

Permalink
DRAW-87 feat: RoomId 대소문자 구분 안함
Browse files Browse the repository at this point in the history
  • Loading branch information
comforest committed Jul 8, 2024
1 parent e72271d commit ab98cb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class SessionFactory {
fun create(session: WebSocketSession, request: SessionInitializeRequest): Session {
return SessionWrapper(
session,
request.roomId ?: generateRoomId(),
RoomId(request.roomId?.toUpperCase() ?: generateRoomId()),
User(UserId(0), request.nickname), // TODO get User by AccessToken
)
}

private fun generateRoomId(): RoomId {
private fun generateRoomId(): String {
// TODO: 중복 방지
val charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
val value = (1..6)
.map { charset.random() }
.joinToString("")

return RoomId(value)
return value
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.xorker.draw.websocket.dto

import com.xorker.draw.room.RoomId

data class SessionInitializeRequest(
val accessToken: String,
val roomId: RoomId?,
val roomId: String?,
val nickname: String,
)

0 comments on commit ab98cb6

Please sign in to comment.