From 030dbbb4622627497d1853522a34a9c02ad6532d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=83=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A8?= Date: Fri, 18 Aug 2023 23:45:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20adjust=20round=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moyeomoyeo/common/config/SwaggerConfig.java | 6 +++--- .../notification/handler/SseEmitterHandler.java | 10 +++++----- .../service/TeamBuildingAdminService.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/nexters/moyeomoyeo/common/config/SwaggerConfig.java b/src/main/java/com/nexters/moyeomoyeo/common/config/SwaggerConfig.java index d2ea523..d0b193d 100644 --- a/src/main/java/com/nexters/moyeomoyeo/common/config/SwaggerConfig.java +++ b/src/main/java/com/nexters/moyeomoyeo/common/config/SwaggerConfig.java @@ -3,15 +3,15 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.servers.Server; import lombok.RequiredArgsConstructor; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @OpenAPIDefinition( - info = @Info(title = "모여모여 API 명세서", - description = "넥스터즈 팀빌딩 서비스 API 명세서", - version = "v1")) + info = @Info(title = "모여모여 API 명세서", description = "넥스터즈 팀빌딩 서비스 API 명세서", version = "v1"), + servers = @Server(url = "/")) @RequiredArgsConstructor @Configuration public class SwaggerConfig { diff --git a/src/main/java/com/nexters/moyeomoyeo/notification/handler/SseEmitterHandler.java b/src/main/java/com/nexters/moyeomoyeo/notification/handler/SseEmitterHandler.java index be74a97..ef24145 100644 --- a/src/main/java/com/nexters/moyeomoyeo/notification/handler/SseEmitterHandler.java +++ b/src/main/java/com/nexters/moyeomoyeo/notification/handler/SseEmitterHandler.java @@ -15,10 +15,10 @@ public class SseEmitterHandler { // key : teamBuildingUuid - private final Map> emitterMap = new ConcurrentHashMap<>(); + private static final Map> EMITTER_MAP = new ConcurrentHashMap<>(); public List getEmitters(String teamBuildingUuid) { - final List emitterList = emitterMap.get(teamBuildingUuid); + final List emitterList = EMITTER_MAP.get(teamBuildingUuid); if (Objects.isNull(emitterList)) { return Collections.emptyList(); @@ -28,11 +28,11 @@ public List getEmitters(String teamBuildingUuid) { } public void add(String teamBuildingUuid, SseEmitter emitter) { - final List emitterList = Objects.isNull(this.emitterMap.get(teamBuildingUuid)) ? - new CopyOnWriteArrayList<>() : this.emitterMap.get(teamBuildingUuid); + final List emitterList = Objects.isNull(EMITTER_MAP.get(teamBuildingUuid)) ? + new CopyOnWriteArrayList<>() : EMITTER_MAP.get(teamBuildingUuid); emitterList.add(emitter); - emitterMap.put(teamBuildingUuid, emitterList); + EMITTER_MAP.put(teamBuildingUuid, emitterList); log.info("new emitter added: {}, {}", teamBuildingUuid, emitter); log.info("emitter list size: {}", emitterList.size()); diff --git a/src/main/java/com/nexters/moyeomoyeo/team_building/service/TeamBuildingAdminService.java b/src/main/java/com/nexters/moyeomoyeo/team_building/service/TeamBuildingAdminService.java index 57c2573..58ab4b1 100644 --- a/src/main/java/com/nexters/moyeomoyeo/team_building/service/TeamBuildingAdminService.java +++ b/src/main/java/com/nexters/moyeomoyeo/team_building/service/TeamBuildingAdminService.java @@ -15,10 +15,8 @@ import com.nexters.moyeomoyeo.team_building.domain.entity.Team; import com.nexters.moyeomoyeo.team_building.domain.entity.TeamBuilding; import com.nexters.moyeomoyeo.team_building.domain.entity.User; - import java.util.List; import java.util.Objects; - import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -45,9 +43,11 @@ public UserInfo adjustUser(String teamBuildingUuid, String userUuid, String team .filter(team -> Objects.equals(team.getUuid(), teamUuid)) .findFirst() .orElse(null); + user.adjustTeam(targetTeam); - UserInfo userInfo = makeUserInfo(user); + user.updateSelectedRound(Objects.isNull(targetTeam) ? null : RoundStatus.ADJUSTED_ROUND); + UserInfo userInfo = makeUserInfo(user); notificationService.broadCast(teamBuildingUuid, "adjust-user", userInfo); return userInfo; }