Skip to content

Commit

Permalink
feat: spark getList memberId 제거 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ympark99 authored Sep 30, 2023
1 parent 7890ee6 commit e4989ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -41,8 +40,10 @@ public ResponseEntity<String> applySpark(@RequestBody ApplyRequest applyRequest,

@Operation(description = "신청 내역 확인하기")
@GetMapping("/list/{memberId}")
public ResponseEntity<List<ApplyDto>> getList(@PathVariable("memberId") Long memberId) {
return ResponseEntity.ok().body(applyUseCase.getList(memberId));
public ResponseEntity<List<ApplyDto>> getList(
@AuthenticationPrincipal CustomUserDetails customUserDetails) {
Member applicant = customUserDetails.getMember();
return ResponseEntity.ok().body(applyUseCase.getList(applicant));
}

@Operation(description = "스파크 지원 수락/거절하기")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ String apply(
Long sparkId
);

List<ApplyDto> getList(Long memberId);
List<ApplyDto> getList(Member applicant);

String applyProcess(Long sparkId, Long applicantId, AcceptStatus acceptStatus);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApplyDto> getList(Long memberId) {
Member applicant = memberUseCase.getById(memberId);
public List<ApplyDto> getList(Member applicant) {
return loadApplyPort.getList(applicant);
}

Expand Down

0 comments on commit e4989ba

Please sign in to comment.