Skip to content

Commit

Permalink
Merge pull request #45 from Nexters/dev
Browse files Browse the repository at this point in the history
비정기 배포 (8월 17일 이슈)
  • Loading branch information
her0807 authored Aug 17, 2023
2 parents 6e06182 + 47948b8 commit cd49bb0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum ExceptionInfo {
COMPLETED_TEAM_BUILDING("이미 종료된 팀빌딩입니다.", HttpStatus.BAD_REQUEST),
INVALID_ADJUST_REQUEST("조정 라운드에서만 조정 가능합니다.", HttpStatus.BAD_REQUEST),
INVALID_FINISH_REQUEST("조정 라운드에서만 팀빌딩을 종료할 수 있습니다.", HttpStatus.BAD_REQUEST),
INVALID_DELETE_REQUEST("1라운드에서만 회원을 삭제할 수 있습니다.", HttpStatus.BAD_REQUEST),
DUPLICATED_PICK_REQUEST("이미 선택이 완료된 팀입니다.", HttpStatus.BAD_REQUEST);
@Getter
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ResponseEntity<TeamBuildingResponse> createTeamBuilding(
""")
@PostMapping("/{teamBuildingUuid}/users/{userUuid}")
public ResponseEntity<UserInfo> adjustUser(@PathVariable(value = "teamBuildingUuid") String teamBuildingUuid,
@PathVariable(value = "userUuid") String userUuid, @RequestBody @Valid UserAdjustRequest userAdjustRequest) {
@PathVariable(value = "userUuid") String userUuid, @RequestBody @Valid UserAdjustRequest userAdjustRequest) {
return ResponseEntity.ok(adminService.adjustUser(teamBuildingUuid, userUuid, userAdjustRequest.getTeamUuid()));
}

Expand All @@ -58,8 +58,8 @@ public ResponseEntity<UserInfo> adjustUser(@PathVariable(value = "teamBuildingUu
""")
@DeleteMapping("/{teamBuildingUuid}/users/{userUuid}")
public ResponseEntity<Void> deleteUser(@PathVariable(value = "teamBuildingUuid") String teamBuildingUuid,
@PathVariable(value = "userUuid") String userUuid) {
userService.deleteUser(teamBuildingUuid, userUuid);
@PathVariable(value = "userUuid") String userUuid) {
adminService.deleteTeamBuildingUser(teamBuildingUuid, userUuid);
return ResponseEntity.ok().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.nexters.moyeomoyeo.team_building.domain.entity.User;
import com.nexters.moyeomoyeo.team_building.domain.entity.UserChoice;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;
import java.util.Objects;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -29,6 +31,7 @@ public class UserInfo {
private List<String> choices;
@Schema(description = "최종 빌딩 된 팀")
private String joinedTeamUuid;
@Schema(description = "팀원 추가 링크")
private String profileLink;
@Builder.Default
@Schema(description = "현재 팀 빌딩이 완료된 상태인지 여부")
Expand All @@ -47,6 +50,7 @@ public static UserInfo makeUserInfo(User user) {
.position(user.getPosition())
.choices(choices)
.joinedTeamUuid(joinedTeamUuid)
.profileLink(user.getProfileLink())
.isSelectedTeam(isSelectedTeam(choices, joinedTeamUuid))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
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 Down Expand Up @@ -51,6 +53,16 @@ public UserInfo adjustUser(String teamBuildingUuid, String userUuid, String team
}


@Transactional
public void deleteTeamBuildingUser(String uuid, String userUuid) {
final TeamBuilding teamBuilding = teamBuildingService.findByUuid(uuid);

if (RoundStatus.FIRST_ROUND != teamBuilding.getRoundStatus()) {
throw ExceptionInfo.INVALID_DELETE_REQUEST.exception();
}
userService.deleteUser(uuid, userUuid);
}

@Transactional
public void finishTeamBuilding(String uuid) {
final TeamBuilding teamBuilding = teamBuildingService.findByUuid(uuid);
Expand Down

0 comments on commit cd49bb0

Please sign in to comment.