Skip to content

Commit

Permalink
[refactor] SessionArgumentResolver 구현에 맞게 컨트롤러 메서드 시그니쳐 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
june-777 committed Aug 13, 2024
1 parent 6e088ca commit 2696f11
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import camp.woowak.lab.store.service.StoreRegistrationService;
import camp.woowak.lab.store.service.dto.StoreRegistrationRequest;
import camp.woowak.lab.vendor.domain.Vendor;
import camp.woowak.lab.vendor.repository.VendorRepository;
import camp.woowak.lab.web.authentication.LoginVendor;
import camp.woowak.lab.web.authentication.annotation.AuthenticationPrincipal;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

Expand All @@ -16,15 +19,17 @@
public class StoreApiController {

private final StoreRegistrationService storeRegistrationService;
private final VendorRepository vendorRepository;

// TODO:
// 1. 인증/인가에 대한 스펙이 정의되어야, Vendor Resolver 로직을 결정할 수 있음
// 2. SSR, CSR 에 대해 통일해야, API 반환타입을 fix 할 수 있음
// 3. API 공통 응답 명세에 대한 논의 진행 필요
@PostMapping("/stores")
public ResponseEntity<Void> storeRegistration(final Vendor vendor,
public ResponseEntity<Void> storeRegistration(@AuthenticationPrincipal final LoginVendor loginVendor,
final @Valid @RequestBody StoreRegistrationRequest request
) {
Vendor vendor = vendorRepository.findById(loginVendor.getId()).orElseThrow();
storeRegistrationService.storeRegistration(vendor, request);
return ResponseEntity.ok().build();
}
Expand Down

0 comments on commit 2696f11

Please sign in to comment.