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

fix: adjust round 오류 수정 #50

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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