Skip to content

Commit

Permalink
fix: 기존의 등록 로직 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
Dltmd202 committed Aug 7, 2024
1 parent 410778f commit 9ee7b6b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ data class WorkspaceSession
@JsonProperty("id") val id: String,
@JsonProperty("userId") val userId: String,
@JsonProperty("workspaceId") val workspaceId: Long,
@JsonProperty("realtimeId") val realtimeId: Long,
@JsonProperty("realtimeId") val realtimeId: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class WorkspaceSessionRedisData
@JsonProperty("id") val id: String,
@JsonProperty("userId") val userId: String,
@JsonProperty("workspaceId") val workspaceId: Long,
@JsonProperty("realtimeId") val realtimeId: Long,
@JsonProperty("realtimeId") val realtimeId: String,
) {
companion object {
fun of(workspaceSession: WorkspaceSession) =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class WorkspaceWebSocketSession<T>(
val id: String,
val userId: String,
val workspaceId: Long,
val realTimeId: Long,
val realTimeId: String,
val session: T,
) {
fun toDomain() = WorkspaceSession(id, userId, workspaceId, realTimeId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.backgu.amaker.realtime.ws.handler

import com.backgu.amaker.realtime.orchestration.ServerRegister
import com.backgu.amaker.realtime.server.config.ServerConfig
import com.backgu.amaker.realtime.utils.WebSocketSessionUtils
import com.backgu.amaker.realtime.workspace.service.WorkspaceSessionFacadeService
import com.backgu.amaker.realtime.workspace.session.WorkspaceWebSocketSession
Expand All @@ -14,14 +14,15 @@ import org.springframework.web.socket.handler.TextWebSocketHandler
@Component
class WebSocketSessionHandler(
private val workspaceSessionFacadeService: WorkspaceSessionFacadeService,
private val serverConfig: ServerConfig,
) : TextWebSocketHandler() {
override fun afterConnectionEstablished(session: WebSocketSession) {
val userId: String = WebSocketSessionUtils.extractAttribute<String>(session, USER_ID)
val workspaceId = WebSocketSessionUtils.extractAttribute<Long>(session, WORKSPACE_ID)
workspaceSessionFacadeService.enrollUserToWorkspaceSession(
userId,
workspaceId,
WorkspaceWebSocketSession(session.id, userId, workspaceId, ServerRegister.serverId, session),
WorkspaceWebSocketSession(session.id, userId, workspaceId, serverConfig.id, session),
)
}

Expand All @@ -35,7 +36,7 @@ class WebSocketSessionHandler(
workspaceSessionFacadeService.dropOutWorkspaceSession(
userId,
workspaceId,
WorkspaceWebSocketSession(session.id, userId, workspaceId, ServerRegister.serverId, session),
WorkspaceWebSocketSession(session.id, userId, workspaceId, serverConfig.id, session),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WorkspaceSessionRepositoryTest : IntegrationTest() {
fun addWorkspaceSessionTest() {
// given
val workspaceId = 1L
val workspaceSession = WorkspaceSession(UUID.randomUUID().toString(), "userId", workspaceId, 1)
val workspaceSession = WorkspaceSession(UUID.randomUUID().toString(), "userId", workspaceId, "1")

// when
workspaceSessionRepository.addWorkspaceSession(workspaceId, workspaceSession)
Expand Down

0 comments on commit 9ee7b6b

Please sign in to comment.