Skip to content

Commit 2e5793c

Browse files
committed
feat: 마이바(MyBar) 칵테일 킵(Keep) API 추가
- `POST /me/bar/{cocktailId}/keep` 엔드포인트 추가 - URL `@PathVariable`로 칵테일 ID를 받고, `@AuthenticationPrincipal`로 사용자 ID를 획득 - `MyBarService`의 `keep` 메서드를 호출하여 킵 기능 처리 - 성공 시 HTTP 201 상태 코드와 "kept" 메시지 반환
1 parent df6038a commit 2e5793c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/com/back/domain/mybar/controller/MyBarController.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
import lombok.RequiredArgsConstructor;
99
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1010
import org.springframework.validation.annotation.Validated;
11-
import org.springframework.web.bind.annotation.GetMapping;
12-
import org.springframework.web.bind.annotation.RequestMapping;
13-
import org.springframework.web.bind.annotation.RequestParam;
14-
import org.springframework.web.bind.annotation.RestController;
11+
import org.springframework.web.bind.annotation.*;
1512

1613
@RestController
1714
@RequestMapping("/me/bar")
@@ -30,4 +27,14 @@ public RsData<MyBarListResponseDto> getMyBarList(
3027
MyBarListResponseDto body = myBarService.getMyBar(userId, page, pageSize);
3128
return RsData.successOf(body); // code=200, message="success"
3229
}
30+
31+
/** 킵 추가(생성/복원/재킵) */
32+
@PostMapping("/{cocktailId}/keep")
33+
public RsData<Void> keep(
34+
@AuthenticationPrincipal(expression = "id") Long userId,
35+
@PathVariable Long cocktailId
36+
) {
37+
myBarService.keep(userId, cocktailId);
38+
return RsData.of(201, "kept"); // Aspect가 HTTP 201로 설정
39+
}
3340
}

0 commit comments

Comments
 (0)