|
| 1 | +package com.back.domain.mybar.controller; |
| 2 | + |
| 3 | +import com.back.domain.mybar.dto.MyBarListResponseDto; |
| 4 | +import com.back.domain.mybar.service.MyBarService; |
| 5 | +import com.back.global.rsData.RsData; |
| 6 | +import jakarta.validation.constraints.Max; |
| 7 | +import jakarta.validation.constraints.Min; |
| 8 | +import lombok.RequiredArgsConstructor; |
| 9 | +import org.springframework.security.core.annotation.AuthenticationPrincipal; |
| 10 | +import org.springframework.stereotype.Repository; |
| 11 | +import org.springframework.validation.annotation.Validated; |
| 12 | +import org.springframework.web.bind.annotation.GetMapping; |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | +import org.springframework.web.bind.annotation.RequestParam; |
| 15 | + |
| 16 | +@Repository |
| 17 | +@RequestMapping("/me/bar") |
| 18 | +@RequiredArgsConstructor |
| 19 | +@Validated |
| 20 | +public class MyBarController { |
| 21 | + |
| 22 | + private final MyBarService myBarService; |
| 23 | + |
| 24 | + @GetMapping |
| 25 | + public RsData<MyBarListResponseDto> getMyBarList( |
| 26 | + @AuthenticationPrincipal(expression = "id") Long userId, |
| 27 | + @RequestParam(defaultValue = "0") @Min(0) int page, |
| 28 | + @RequestParam(defaultValue = "20") @Min(1) @Max(100) int pageSize |
| 29 | + ) { |
| 30 | + MyBarListResponseDto body = myBarService.getMyBar(userId, page, pageSize); |
| 31 | + return RsData.successOf(body); // code=200, message="success" |
| 32 | + } |
| 33 | +} |
0 commit comments