From 7e85aaba50c24ecd8e179e865e9e3f6d6f2c274a Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 22:51:28 +0900 Subject: [PATCH 1/9] =?UTF-8?q?refactor:=20getCurrentUser=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD:?= =?UTF-8?q?=20ProgramService=20->=20MemberService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 23 +++++++++++++++++++ .../program/service/ProgramMemberService.java | 8 ++++--- .../program/service/ProgramService.java | 23 +++++++------------ 3 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/efub/dhs/domain/member/service/MemberService.java diff --git a/src/main/java/com/efub/dhs/domain/member/service/MemberService.java b/src/main/java/com/efub/dhs/domain/member/service/MemberService.java new file mode 100644 index 0000000..5017fba --- /dev/null +++ b/src/main/java/com/efub/dhs/domain/member/service/MemberService.java @@ -0,0 +1,23 @@ +package com.efub.dhs.domain.member.service; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.efub.dhs.domain.member.entity.Member; +import com.efub.dhs.domain.member.repository.MemberRepository; +import com.efub.dhs.global.utils.SecurityUtils; + +import lombok.RequiredArgsConstructor; + +@Service +@Transactional +@RequiredArgsConstructor +public class MemberService { + private final MemberRepository memberRepository; + + public Member getCurrentUser() { + String username = SecurityUtils.getCurrentUsername(); + return memberRepository.findByUsername(username) + .orElseThrow(() -> new IllegalArgumentException("해당 아이디의 회원을 찾을 수 없습니다.")); + } +} diff --git a/src/main/java/com/efub/dhs/domain/program/service/ProgramMemberService.java b/src/main/java/com/efub/dhs/domain/program/service/ProgramMemberService.java index af70d95..1baf7ac 100644 --- a/src/main/java/com/efub/dhs/domain/program/service/ProgramMemberService.java +++ b/src/main/java/com/efub/dhs/domain/program/service/ProgramMemberService.java @@ -12,6 +12,7 @@ import com.efub.dhs.domain.heart.service.HeartService; import com.efub.dhs.domain.member.entity.Member; +import com.efub.dhs.domain.member.service.MemberService; import com.efub.dhs.domain.program.dto.PageInfoDto; import com.efub.dhs.domain.program.dto.response.ProgramListResponseDto; import com.efub.dhs.domain.program.dto.response.ProgramOutlineResponseDto; @@ -33,10 +34,11 @@ public class ProgramMemberService { private final RegistrationRepository registrationRepository; private final ProgramService programService; private final HeartService heartService; + private final MemberService memberService; @Transactional(readOnly = true) public ProgramListResponseDto findProgramCreated(int page) { - Member currentUser = programService.getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Page programPage = programRepository.findAllByHost(currentUser, PageRequest.of(page, PAGE_SIZE)); PageInfoDto pageInfoDto = PageInfoDto.createProgramPageInfoDto(programPage); List programOutlineResponseDtoList = @@ -46,7 +48,7 @@ public ProgramListResponseDto findProgramCreated(int page) { @Transactional(readOnly = true) public ProgramListResponseDto findProgramLiked(int page) { - Member currentUser = programService.getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Page programPage = programRepository.findAllProgramLiked(currentUser, PageRequest.of(page, PAGE_SIZE)); PageInfoDto pageInfoDto = PageInfoDto.createProgramPageInfoDto(programPage); List programOutlineResponseDtoList = @@ -56,7 +58,7 @@ public ProgramListResponseDto findProgramLiked(int page) { @Transactional(readOnly = true) public ProgramRegisteredResponseDto findProgramRegistered(int page) { - Member currentUser = programService.getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Page registrationPage = registrationRepository.findRegisteredPrograms( currentUser, PageRequest.of(page, PAGE_SIZE)); PageInfoDto pageInfoDto = PageInfoDto.createRegistrationPageInfoDto(registrationPage); diff --git a/src/main/java/com/efub/dhs/domain/program/service/ProgramService.java b/src/main/java/com/efub/dhs/domain/program/service/ProgramService.java index 0adc2f4..e497d09 100644 --- a/src/main/java/com/efub/dhs/domain/program/service/ProgramService.java +++ b/src/main/java/com/efub/dhs/domain/program/service/ProgramService.java @@ -12,7 +12,7 @@ import com.efub.dhs.domain.heart.service.HeartService; import com.efub.dhs.domain.member.entity.Member; -import com.efub.dhs.domain.member.repository.MemberRepository; +import com.efub.dhs.domain.member.service.MemberService; import com.efub.dhs.domain.program.dto.GoalDto; import com.efub.dhs.domain.program.dto.HostDto; import com.efub.dhs.domain.program.dto.ImageDto; @@ -34,7 +34,6 @@ import com.efub.dhs.domain.program.repository.ProgramRepository; import com.efub.dhs.domain.registration.entity.Registration; import com.efub.dhs.domain.registration.service.RegistrationService; -import com.efub.dhs.global.utils.SecurityUtils; import lombok.RequiredArgsConstructor; @@ -48,17 +47,11 @@ public class ProgramService { private final ProgramRepository programRepository; private final ProgramImageRepository programImageRepository; private final NoticeRepository noticeRepository; - private final MemberRepository memberRepository; + private final MemberService memberService; private final HeartService heartService; private final RegistrationService registrationService; - public Member getCurrentUser() { - String username = SecurityUtils.getCurrentUsername(); - return memberRepository.findByUsername(username) - .orElseThrow(() -> new IllegalArgumentException("해당 아이디의 회원을 찾을 수 없습니다.")); - } - - private Program getProgram(Long programId) { + public Program getProgram(Long programId) { return programRepository.findById(programId) .orElseThrow(() -> new IllegalArgumentException("해당 ID의 행사를 찾을 수 없습니다.")); } @@ -67,7 +60,7 @@ private Program getProgram(Long programId) { public ProgramDetailResponseDto findProgramById(Long programId) { Program program = getProgram(programId); - Member currentUser = getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Integer remainingDays = calculateRemainingDays(program.getDeadline()); @@ -136,7 +129,7 @@ public List convertToProgramOutlineResponseDtoList( } public Long createProgram(ProgramCreationRequestDto requestDto) { - Member currentUser = getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Program program = requestDto.toEntity(currentUser); Long programId = programRepository.save(program).getProgramId(); List images = program.getImages(); @@ -145,17 +138,17 @@ public Long createProgram(ProgramCreationRequestDto requestDto) { } public Registration registerProgram(Long programId, ProgramRegistrationRequestDto requestDto) { - Member currentUser = getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Program program = getProgram(programId); Registration registration = requestDto.toEntity(currentUser, program); return registrationService.saveRegistration(registration); } public ProgramListResponseDto findProgramList(int page, ProgramListRequestDto requestDto) { - Member currentUser = getCurrentUser(); + Member currentUser = memberService.getCurrentUser(); Page programPage = programRepository.findProgramListByFilter(requestDto, PageRequest.of(page, PAGE_SIZE)); - PageInfoDto pageInfoDto = PageInfoDto.from(programPage); + PageInfoDto pageInfoDto = PageInfoDto.createProgramPageInfoDto(programPage); List programOutlineResponseDtoList = convertToProgramOutlineResponseDtoList(programPage.getContent(), currentUser); return new ProgramListResponseDto(programOutlineResponseDtoList, pageInfoDto); From 2cfbded6c65ca9d2da8ccdd4fca0044d6e5043cf Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 22:56:16 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EA=B2=B0=EC=A0=9C=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=A5=BC=20=EB=8B=B4=EC=9D=84=20DTO=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/registration/dto/PaymentDto.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/efub/dhs/domain/registration/dto/PaymentDto.java diff --git a/src/main/java/com/efub/dhs/domain/registration/dto/PaymentDto.java b/src/main/java/com/efub/dhs/domain/registration/dto/PaymentDto.java new file mode 100644 index 0000000..e24fbc1 --- /dev/null +++ b/src/main/java/com/efub/dhs/domain/registration/dto/PaymentDto.java @@ -0,0 +1,24 @@ +package com.efub.dhs.domain.registration.dto; + +import java.time.LocalDateTime; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class PaymentDto { + + private Boolean check; + private String name; + private LocalDateTime date; + private String price; + + public PaymentDto(Boolean check, String name, LocalDateTime date, String price) { + this.check = check; + this.name = name; + this.date = date; + this.price = price; + } +} From e6ed513f170efa5a6c841c880d522e39828b37de Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 22:56:23 +0900 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=ED=99=98=EB=B6=88=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=A5=BC=20=EB=8B=B4=EC=9D=84=20DTO=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/registration/dto/RefundDto.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/efub/dhs/domain/registration/dto/RefundDto.java diff --git a/src/main/java/com/efub/dhs/domain/registration/dto/RefundDto.java b/src/main/java/com/efub/dhs/domain/registration/dto/RefundDto.java new file mode 100644 index 0000000..f07d71b --- /dev/null +++ b/src/main/java/com/efub/dhs/domain/registration/dto/RefundDto.java @@ -0,0 +1,24 @@ +package com.efub.dhs.domain.registration.dto; + +import com.efub.dhs.domain.registration.entity.RefundStatus; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class RefundDto { + + private String status; + private String bank; + private String account; + private String name; + + public RefundDto(RefundStatus refundStatus, String bank, String account, String name) { + this.status = RefundStatus.to(refundStatus); + this.bank = bank; + this.account = account; + this.name = name; + } +} From e174873f90ff9fe65b09c8efc7052a0e97d1cce8 Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 22:57:10 +0900 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=EC=8B=A0=EC=B2=AD=EC=9E=90=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EB=8B=B4=EC=9D=84=20DTO=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/RegistrationResponseDto.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/com/efub/dhs/domain/registration/dto/RegistrationResponseDto.java diff --git a/src/main/java/com/efub/dhs/domain/registration/dto/RegistrationResponseDto.java b/src/main/java/com/efub/dhs/domain/registration/dto/RegistrationResponseDto.java new file mode 100644 index 0000000..1323f8c --- /dev/null +++ b/src/main/java/com/efub/dhs/domain/registration/dto/RegistrationResponseDto.java @@ -0,0 +1,28 @@ +package com.efub.dhs.domain.registration.dto; + +import com.efub.dhs.domain.registration.entity.Registration; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PROTECTED) +public class RegistrationResponseDto { + + private String name; + private String phone; + private PaymentDto payment; + private RefundDto refund; + + public static RegistrationResponseDto from(Registration registration) { + return new RegistrationResponseDto( + registration.getRegistrantName(), + registration.getRegistrantPhone(), + new PaymentDto(registration.getDepositCheck(), registration.getDepositName(), + registration.getDepositDate(), registration.getDepositAmount()), + new RefundDto(registration.getRefundStatus(), registration.getRefundBank(), + registration.getRefundAccount(), registration.getRefundName()) + ); + } +} From ade765d262259b3040c563302b83837e52325d9e Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 23:00:43 +0900 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20RefundStatus=20enum=EA=B3=BC=20name?= =?UTF-8?q?=EC=9D=84=20=EC=96=BB=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/registration/entity/RefundStatus.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/efub/dhs/domain/registration/entity/RefundStatus.java b/src/main/java/com/efub/dhs/domain/registration/entity/RefundStatus.java index 3ee4a35..513f4d4 100644 --- a/src/main/java/com/efub/dhs/domain/registration/entity/RefundStatus.java +++ b/src/main/java/com/efub/dhs/domain/registration/entity/RefundStatus.java @@ -1,5 +1,7 @@ package com.efub.dhs.domain.registration.entity; +import java.util.Arrays; + import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @@ -9,4 +11,15 @@ public enum RefundStatus { COMPLETED("환불완료"); private final String name; + + public static RefundStatus from(String name) { + return Arrays.stream(RefundStatus.values()) + .filter(refundStatus -> refundStatus.name.equals(name)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Invalid RefundStatus name: " + name)); + } + + public static String to(RefundStatus refundStatus) { + return refundStatus.name; + } } From bde20c989a630ca0507fc598c9a112de7d6ca728 Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 23:02:03 +0900 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20=EC=8B=A0=EC=B2=AD=EC=9E=90=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=EB=A5=BC=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=A0=88=ED=8F=AC=EC=A7=80=ED=86=A0=EB=A6=AC=20?= =?UTF-8?q?=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/repository/RegistrationRepository.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/efub/dhs/domain/registration/repository/RegistrationRepository.java b/src/main/java/com/efub/dhs/domain/registration/repository/RegistrationRepository.java index bdb555e..ba1490b 100644 --- a/src/main/java/com/efub/dhs/domain/registration/repository/RegistrationRepository.java +++ b/src/main/java/com/efub/dhs/domain/registration/repository/RegistrationRepository.java @@ -1,5 +1,7 @@ package com.efub.dhs.domain.registration.repository; +import java.util.List; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; @@ -15,4 +17,6 @@ public interface RegistrationRepository extends JpaRepository findRegisteredPrograms(Member registrant, Pageable pageable); + + List findAllByProgram(Program program); } From 80cb82097acf41ff347477d81fdc8be42b60268e Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 23:34:09 +0900 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20=EC=8B=A0=EC=B2=AD=EC=9E=90=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=EB=A5=BC=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/RegistrationService.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java b/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java index 8d86e8e..0dd9795 100644 --- a/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java +++ b/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java @@ -1,10 +1,15 @@ package com.efub.dhs.domain.registration.service; +import java.util.List; +import java.util.stream.Collectors; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.efub.dhs.domain.member.entity.Member; +import com.efub.dhs.domain.member.service.MemberService; import com.efub.dhs.domain.program.entity.Program; +import com.efub.dhs.domain.registration.dto.RegistrationResponseDto; import com.efub.dhs.domain.registration.entity.Registration; import com.efub.dhs.domain.registration.repository.RegistrationRepository; @@ -16,6 +21,7 @@ public class RegistrationService { private final RegistrationRepository registrationRepository; + private final MemberService memberService; @Transactional(readOnly = true) public Boolean existsByMemberAndProgram(Member member, Program program) { @@ -26,4 +32,15 @@ public Boolean existsByMemberAndProgram(Member member, Program program) { public Registration saveRegistration(Registration registration) { return registrationRepository.save(registration); } + + @Transactional(readOnly = true) + public List findRegistratorList(Program program) { + Member member = memberService.getCurrentUser(); + if (member.equals(program.getHost())) { + List registrationList = registrationRepository.findAllByProgram(program); + return registrationList.stream().map(RegistrationResponseDto::from).collect(Collectors.toList()); + } else { + throw new SecurityException("접근 권한이 없습니다."); + } + } } From 944aca56c0687c04a5e6710ade9742708da32abd Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 23:34:16 +0900 Subject: [PATCH 8/9] =?UTF-8?q?feat:=20=EC=8B=A0=EC=B2=AD=EC=9E=90=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=EB=A5=BC=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../program/controller/ProgramController.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/efub/dhs/domain/program/controller/ProgramController.java b/src/main/java/com/efub/dhs/domain/program/controller/ProgramController.java index 47b0e04..4228da7 100644 --- a/src/main/java/com/efub/dhs/domain/program/controller/ProgramController.java +++ b/src/main/java/com/efub/dhs/domain/program/controller/ProgramController.java @@ -20,12 +20,15 @@ import com.efub.dhs.domain.program.dto.response.ProgramCreationResponseDto; import com.efub.dhs.domain.program.dto.response.ProgramDetailResponseDto; import com.efub.dhs.domain.program.dto.response.ProgramListResponseDto; -import com.efub.dhs.domain.program.dto.response.ProgramRegisteredResponseDto; import com.efub.dhs.domain.program.dto.response.ProgramOutlineResponseDto; +import com.efub.dhs.domain.program.dto.response.ProgramRegisteredResponseDto; import com.efub.dhs.domain.program.dto.response.ProgramRegistrationResponseDto; +import com.efub.dhs.domain.program.entity.Program; import com.efub.dhs.domain.program.service.ProgramMemberService; import com.efub.dhs.domain.program.service.ProgramService; +import com.efub.dhs.domain.registration.dto.RegistrationResponseDto; import com.efub.dhs.domain.registration.entity.Registration; +import com.efub.dhs.domain.registration.service.RegistrationService; import lombok.RequiredArgsConstructor; @@ -36,6 +39,7 @@ public class ProgramController { private final ProgramService programService; private final ProgramMemberService programMemberService; + private final RegistrationService registrationService; @GetMapping("/{programId}") @ResponseStatus(value = HttpStatus.OK) @@ -70,8 +74,8 @@ public ProgramListResponseDto findProgramLiked(@RequestParam int page) { @GetMapping("/registered") public ProgramRegisteredResponseDto findProgramRegistered(@RequestParam int page) { return programMemberService.findProgramRegistered(page); - } - + } + @GetMapping public ProgramListResponseDto findProgramList(@RequestParam int page, ProgramListRequestDto requestDto) { return programService.findProgramList(page, requestDto); @@ -81,4 +85,10 @@ public ProgramListResponseDto findProgramList(@RequestParam int page, ProgramLis public List findProgramPopular() { return programService.findProgramPopular(); } + + @GetMapping("/{programId}/registrations") + public List findRegistratorList(@PathVariable Long programId) { + Program program = programService.getProgram(programId); + return registrationService.findRegistratorList(program); + } } From 6a53e055308eb3b15e795d23a5cf531a149ea53f Mon Sep 17 00:00:00 2001 From: yeji Date: Thu, 23 Nov 2023 23:57:44 +0900 Subject: [PATCH 9/9] =?UTF-8?q?refactor:=20=ED=98=84=EC=9E=AC=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9E=90=EA=B0=80=20=ED=96=89=EC=82=AC=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EC=9E=90=EA=B0=80=20=EC=95=84=EB=8B=90=20=EB=95=8C=20?= =?UTF-8?q?403=20=EC=97=90=EB=9F=AC=20=EB=A6=AC=ED=84=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dhs/domain/registration/service/RegistrationService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java b/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java index 0dd9795..7446f54 100644 --- a/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java +++ b/src/main/java/com/efub/dhs/domain/registration/service/RegistrationService.java @@ -3,8 +3,10 @@ import java.util.List; import java.util.stream.Collectors; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.server.ResponseStatusException; import com.efub.dhs.domain.member.entity.Member; import com.efub.dhs.domain.member.service.MemberService; @@ -40,7 +42,7 @@ public List findRegistratorList(Program program) { List registrationList = registrationRepository.findAllByProgram(program); return registrationList.stream().map(RegistrationResponseDto::from).collect(Collectors.toList()); } else { - throw new SecurityException("접근 권한이 없습니다."); + throw new ResponseStatusException(HttpStatus.FORBIDDEN); } } }