Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@
import com.nowait.applicationuser.menu.service.MenuService;
import com.nowait.common.api.ApiUtils;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Tag(name = "Menu API", description = "메뉴 API")
@RestController
@RequestMapping("/v1/menus")
@RequiredArgsConstructor
@Slf4j
public class MenuController {

private final MenuService menuService;

@GetMapping("/all-menus/stores/{storeId}")
@Operation(summary = "가게의 모든 메뉴 조회", description = "특정 가게의 모든 메뉴를 조회합니다.")
@ApiResponse(responseCode = "200", description = "모든 메뉴를 조회 성공")
public ResponseEntity<?> getMenusByStoreId(@PathVariable Long storeId) {
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -31,6 +39,9 @@ public ResponseEntity<?> getMenusByStoreId(@PathVariable Long storeId) {
}

@GetMapping("/{storeId}/{menuId}")
@Operation(
summary = "메뉴 ID로 메뉴 조회", description = "특정 가게의 특정 메뉴를 ID로 조회합니다.")
@ApiResponse(responseCode = "200", description = "메뉴 조회 성공")
public ResponseEntity<?> getMenuById(
@PathVariable Long storeId,
@PathVariable Long menuId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@
import com.nowait.applicationuser.store.service.StoreService;
import com.nowait.common.api.ApiUtils;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Tag(name = "Store API", description = "주점(Store) API")
@RestController
@RequestMapping("v1/stores")
@RequiredArgsConstructor
@Slf4j
public class StoreController {

private final StoreService storeService;


@GetMapping("/all-stores")
@Operation(summary = "모든 주점 조회", description = "모든 주점을 조회합니다.")
@ApiResponse(responseCode = "200", description = "모든 주점 조회 성공")
public ResponseEntity<?> getAllStores() {
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -34,13 +42,20 @@ public ResponseEntity<?> getAllStores() {
}

@GetMapping("/all-stores/infinite-scroll")
@Operation(
summary = "모든 주점 페이지네이션 조회",
description = "모든 주점을 페이지네이션으로 조회합니다."
)
@ApiResponse(responseCode = "200", description = "모든 주점 페이지네이션 조회 성공")
public ResponseEntity<?> getAllStores(Pageable pageable) {
return ResponseEntity
.ok()
.body(ApiUtils.success(storeService.getAllStoresByPage(pageable)));
}

@GetMapping("/{storeId}")
@Operation(summary = "주점 ID로 주점 상세 조회", description = "특정 주점을 ID로 조회합니다.")
@ApiResponse(responseCode = "200", description = "주점 상세 조회 성공")
public ResponseEntity<?> getStoreById(@PathVariable Long storeId) {
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -52,6 +67,8 @@ public ResponseEntity<?> getStoreById(@PathVariable Long storeId) {
}

@GetMapping("/search")
@Operation(summary = "주점 이름으로 주점 검색", description = "주점 이름을 기준으로 주점을 검색합니다.")
@ApiResponse(responseCode = "200", description = "주점 검색 성공")
public ResponseEntity<?> searchStores(@RequestParam("name") String name) {
return ResponseEntity
.ok()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface StoreService {

StoreReadResponse getAllStores();

public StoreReadResponse getAllStoresByPage(Pageable pageable);
StoreReadResponse getAllStoresByPage(Pageable pageable);

StoreReadDto getStoreByStoreId(Long storeId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ public StoreReadResponse getAllStores() {
return StoreReadResponse.of(storeRead, hasNext);
}

@Override
@Transactional(readOnly = true)
public StoreReadResponse getAllStoresByPage(Pageable pageable) {
Slice<Store> stores = storeRepository.findAllByDeletedFalseOrderByStoreIdDesc(pageable);
Slice<Store> stores = storeRepository.findAllByDeletedFalseOrderByStoreIdAsc(pageable);

List<StoreReadDto> storeRead = stores.getContent().stream()
.map(store -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.nowait.applicationuser.token.service.TokenService;
import com.nowait.externaloauth.jwt.JwtUtil;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

Expand All @@ -27,7 +29,10 @@ public class TokenController {
private long accessTokenExpiration;
@Value("${jwt.refresh-token-expiration-ms}")
private long refreshTokenExpiration;

@PostMapping
@Operation(summary = "리프레시 토큰으로 새로운 액세스 토큰 발급", description = "리프레시 토큰을 사용하여 새로운 액세스 토큰을 발급합니다.")
@ApiResponse(responseCode = "200", description = "새로운 액세스 토큰 발급 성공")
public ResponseEntity<?> refreshToken(@RequestBody RefreshTokenRequest request){
String refreshToken = request.getRefreshToken();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public interface StoreRepository extends JpaRepository<Store, Long> {

List<Store> findByNameContainingIgnoreCaseAndDeletedFalse(String name);

Slice<Store> findAllByDeletedFalseOrderByStoreIdDesc(Pageable pageable);
Slice<Store> findAllByDeletedFalseOrderByStoreIdAsc(Pageable pageable);
}