Skip to content

Commit

Permalink
stag 최신화 (#144)
Browse files Browse the repository at this point in the history
* fix : 대학대표 회원수정 불가능한 이슈 해결

* refactor: 해커톤참가신청 수정 시 참석여부 변경불가능하도록 변경 (#143)
  • Loading branch information
seulgi99 authored Aug 2, 2024
1 parent a16f15c commit ce95db4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public class AdminUserService {
private final UserService userService;
private final AuthenticatedUserUtils authenticatedUserUtils;

@Transactional
public void delete(Long userId) {
User user = userRepository.getById(userId);
userService.deleteUser(user);
}

@Transactional
public void deleteAllUser(List<Long> userIds) {
List<User> users = userRepository.findAllByIdsExactly(userIds);
userService.deleteAll(users);
Expand All @@ -42,6 +44,7 @@ public PageResponse<UserInfoResponseDto> findAllByAdminUserUniv(Pageable pageabl
return PageResponse.of(users.map(UserInfoResponseDto::of));
}

@Transactional
public UserInfoResponseDto updateUser(Long userId, UpdateUserRequestDto updateUserRequestDto) {
User user = userRepository.getByIdWithUniversity(userId);
userService.updateUser(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package likelion.univ.domain.hackathon.exception;

import static likelion.univ.domain.hackathon.exception.HackathonErrorCode.CANNOT_MODIFY_OFFLINE_PARTICIPATION;

import likelion.univ.exception.base.BaseException;

public class CannotModifyOfflineParticipationException extends BaseException {

public CannotModifyOfflineParticipationException() {
super(CANNOT_MODIFY_OFFLINE_PARTICIPATION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public enum HackathonErrorCode implements BaseErrorCode {
REASON_FOR_NOT_OFFLINE_NECESSARY(BAD_REQUEST, "HACKATHON_400_1", "오프라인 해커톤에 불참하는 경우, 불참 사유 작성은 필수입니다."),
ALREADY_APPLIED_HACKATHON(BAD_REQUEST, "HACKATHON_400_2", "이미 신청한 해커톤입니다."),
CANNOT_MODIFY_OFFLINE_PARTICIPATION(BAD_REQUEST, "HACKATHON_400_3", "해커톤 오프라인 참석 여부를 변경할 수 없습니다."),
HACKATHON_NOT_FOUND(NOT_FOUND, "HACKATHON_404_1", "해커톤을 찾을 수 없습니다."),
HACKATHON_FORM_NOT_FOUND(NOT_FOUND, "HACKATHON_404_2", "해커톤 신청서를 찾을 수 없습니다."),
NO_AUTHORITY_GUEST_APPLY_HACKATHON(FORBIDDEN, "HACKATHON_403_1", "회원가입이 완료된 회원만 신청할 수 있습니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import likelion.univ.domain.hackathon.entity.Hackathon;
import likelion.univ.domain.hackathon.entity.HackathonForm;
import likelion.univ.domain.hackathon.exception.AlreadyAppliedHackathonException;
import likelion.univ.domain.hackathon.exception.CannotModifyOfflineParticipationException;
import likelion.univ.domain.hackathon.repository.HackathonFormRepository;
import likelion.univ.domain.hackathon.repository.HackathonRepository;
import likelion.univ.domain.hackathon.repository.condition.HackathonFormSearchCondition;
Expand Down Expand Up @@ -63,6 +64,12 @@ public void modify(HackathonModifyCommand command) {
HackathonForm hackathonForm = hackathonFormRepository.getById(command.hackathonFormId());
User user = userRepository.getById(command.userId());
hackathonForm.validateUser(user);

// 임시로 신청기간 지난 후 오프라인 참가여부 변경 불가능 하도록 변경
if (hackathonForm.isOfflineParticipation() != command.offlineParticipation()) {
throw new CannotModifyOfflineParticipationException();
}

hackathonForm.modify(
command.phone(),
command.hackathonParts(),
Expand Down

0 comments on commit ce95db4

Please sign in to comment.