diff --git a/src/main/java/com/onna/onnaback/domain/apply/adapter/in/web/ApplyController.java b/src/main/java/com/onna/onnaback/domain/apply/adapter/in/web/ApplyController.java index 7333c7d..92ddf6d 100644 --- a/src/main/java/com/onna/onnaback/domain/apply/adapter/in/web/ApplyController.java +++ b/src/main/java/com/onna/onnaback/domain/apply/adapter/in/web/ApplyController.java @@ -2,12 +2,10 @@ import java.util.List; -import com.onna.onnaback.domain.member.application.service.CustomUserDetails; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -18,6 +16,7 @@ import com.onna.onnaback.domain.apply.adapter.in.web.response.ApplyDto; import com.onna.onnaback.domain.apply.application.port.in.ApplyUseCase; import com.onna.onnaback.domain.apply.domain.AcceptStatus; +import com.onna.onnaback.domain.member.application.service.CustomUserDetails; import com.onna.onnaback.domain.member.domain.Member; import io.swagger.v3.oas.annotations.Operation; @@ -41,8 +40,10 @@ public ResponseEntity applySpark(@RequestBody ApplyRequest applyRequest, @Operation(description = "신청 내역 확인하기") @GetMapping("/list/{memberId}") - public ResponseEntity> getList(@PathVariable("memberId") Long memberId) { - return ResponseEntity.ok().body(applyUseCase.getList(memberId)); + public ResponseEntity> getList( + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + Member applicant = customUserDetails.getMember(); + return ResponseEntity.ok().body(applyUseCase.getList(applicant)); } @Operation(description = "스파크 지원 수락/거절하기") diff --git a/src/main/java/com/onna/onnaback/domain/apply/application/port/in/ApplyUseCase.java b/src/main/java/com/onna/onnaback/domain/apply/application/port/in/ApplyUseCase.java index b9c5cef..6af25fc 100644 --- a/src/main/java/com/onna/onnaback/domain/apply/application/port/in/ApplyUseCase.java +++ b/src/main/java/com/onna/onnaback/domain/apply/application/port/in/ApplyUseCase.java @@ -12,7 +12,7 @@ String apply( Long sparkId ); - List getList(Long memberId); + List getList(Member applicant); String applyProcess(Long sparkId, Long applicantId, AcceptStatus acceptStatus); } \ No newline at end of file diff --git a/src/main/java/com/onna/onnaback/domain/apply/application/service/ApplyService.java b/src/main/java/com/onna/onnaback/domain/apply/application/service/ApplyService.java index 38c0187..3e3150e 100644 --- a/src/main/java/com/onna/onnaback/domain/apply/application/service/ApplyService.java +++ b/src/main/java/com/onna/onnaback/domain/apply/application/service/ApplyService.java @@ -41,13 +41,12 @@ public String apply(Member applicant, Long sparkId) throws BaseException { if (spark.getMemberCount() >= spark.getCapacity()) { throw new BaseException(ErrorCode.OVER_MEMBERCOUNT); } - + return saveApplyPort.saveApply(member, spark); } @Override - public List getList(Long memberId) { - Member applicant = memberUseCase.getById(memberId); + public List getList(Member applicant) { return loadApplyPort.getList(applicant); }