Skip to content

Commit

Permalink
fix: adjust round 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
parkdaye committed Aug 18, 2023
1 parent e1aae9a commit 030dbbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
public class SseEmitterHandler {

// key : teamBuildingUuid
private final Map<String, List<SseEmitter>> emitterMap = new ConcurrentHashMap<>();
private static final Map<String, List<SseEmitter>> EMITTER_MAP = new ConcurrentHashMap<>();

public List<SseEmitter> getEmitters(String teamBuildingUuid) {
final List<SseEmitter> emitterList = emitterMap.get(teamBuildingUuid);
final List<SseEmitter> emitterList = EMITTER_MAP.get(teamBuildingUuid);

if (Objects.isNull(emitterList)) {
return Collections.emptyList();
Expand All @@ -28,11 +28,11 @@ public List<SseEmitter> getEmitters(String teamBuildingUuid) {
}

public void add(String teamBuildingUuid, SseEmitter emitter) {
final List<SseEmitter> emitterList = Objects.isNull(this.emitterMap.get(teamBuildingUuid)) ?
new CopyOnWriteArrayList<>() : this.emitterMap.get(teamBuildingUuid);
final List<SseEmitter> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 030dbbb

Please sign in to comment.