Skip to content

Commit bbe8d0c

Browse files
authored
Merge pull request #32 from GTable/feature/#29-swagger-doc
Doc: swagger 어노테이션 추가
2 parents e6f99a0 + abe54b6 commit bbe8d0c

6 files changed

Lines changed: 37 additions & 3 deletions

File tree

application-user/src/main/java/com/nowait/applicationuser/menu/controller/MenuController.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@
1010
import com.nowait.applicationuser.menu.service.MenuService;
1111
import com.nowait.common.api.ApiUtils;
1212

13+
import io.swagger.v3.oas.annotations.Operation;
14+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
15+
import io.swagger.v3.oas.annotations.tags.Tag;
1316
import lombok.RequiredArgsConstructor;
17+
import lombok.extern.slf4j.Slf4j;
1418

19+
@Tag(name = "Menu API", description = "메뉴 API")
1520
@RestController
1621
@RequestMapping("/v1/menus")
1722
@RequiredArgsConstructor
23+
@Slf4j
1824
public class MenuController {
1925

2026
private final MenuService menuService;
2127

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

3341
@GetMapping("/{storeId}/{menuId}")
42+
@Operation(
43+
summary = "메뉴 ID로 메뉴 조회", description = "특정 가게의 특정 메뉴를 ID로 조회합니다.")
44+
@ApiResponse(responseCode = "200", description = "메뉴 조회 성공")
3445
public ResponseEntity<?> getMenuById(
3546
@PathVariable Long storeId,
3647
@PathVariable Long menuId

application-user/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,25 @@
1212
import com.nowait.applicationuser.store.service.StoreService;
1313
import com.nowait.common.api.ApiUtils;
1414

15+
import io.swagger.v3.oas.annotations.Operation;
16+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
17+
import io.swagger.v3.oas.annotations.tags.Tag;
1518
import lombok.RequiredArgsConstructor;
19+
import lombok.extern.slf4j.Slf4j;
1620

21+
@Tag(name = "Store API", description = "주점(Store) API")
1722
@RestController
1823
@RequestMapping("v1/stores")
1924
@RequiredArgsConstructor
25+
@Slf4j
2026
public class StoreController {
2127

2228
private final StoreService storeService;
2329

2430

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

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

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

5469
@GetMapping("/search")
70+
@Operation(summary = "주점 이름으로 주점 검색", description = "주점 이름을 기준으로 주점을 검색합니다.")
71+
@ApiResponse(responseCode = "200", description = "주점 검색 성공")
5572
public ResponseEntity<?> searchStores(@RequestParam("name") String name) {
5673
return ResponseEntity
5774
.ok()

application-user/src/main/java/com/nowait/applicationuser/store/service/StoreService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface StoreService {
1111

1212
StoreReadResponse getAllStores();
1313

14-
public StoreReadResponse getAllStoresByPage(Pageable pageable);
14+
StoreReadResponse getAllStoresByPage(Pageable pageable);
1515

1616
StoreReadDto getStoreByStoreId(Long storeId);
1717

application-user/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public StoreReadResponse getAllStores() {
4545
return StoreReadResponse.of(storeRead, hasNext);
4646
}
4747

48+
@Override
4849
@Transactional(readOnly = true)
4950
public StoreReadResponse getAllStoresByPage(Pageable pageable) {
50-
Slice<Store> stores = storeRepository.findAllByDeletedFalseOrderByStoreIdDesc(pageable);
51+
Slice<Store> stores = storeRepository.findAllByDeletedFalseOrderByStoreIdAsc(pageable);
5152

5253
List<StoreReadDto> storeRead = stores.getContent().stream()
5354
.map(store -> {

application-user/src/main/java/com/nowait/applicationuser/token/controller/TokenController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import com.nowait.applicationuser.token.service.TokenService;
1414
import com.nowait.externaloauth.jwt.JwtUtil;
1515

16+
import io.swagger.v3.oas.annotations.Operation;
17+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
1618
import lombok.RequiredArgsConstructor;
1719
import lombok.extern.slf4j.Slf4j;
1820

@@ -27,7 +29,10 @@ public class TokenController {
2729
private long accessTokenExpiration;
2830
@Value("${jwt.refresh-token-expiration-ms}")
2931
private long refreshTokenExpiration;
32+
3033
@PostMapping
34+
@Operation(summary = "리프레시 토큰으로 새로운 액세스 토큰 발급", description = "리프레시 토큰을 사용하여 새로운 액세스 토큰을 발급합니다.")
35+
@ApiResponse(responseCode = "200", description = "새로운 액세스 토큰 발급 성공")
3136
public ResponseEntity<?> refreshToken(@RequestBody RefreshTokenRequest request){
3237
String refreshToken = request.getRefreshToken();
3338

domain-store/src/main/java/com/nowait/store/repository/StoreRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ public interface StoreRepository extends JpaRepository<Store, Long> {
1919

2020
List<Store> findByNameContainingIgnoreCaseAndDeletedFalse(String name);
2121

22-
Slice<Store> findAllByDeletedFalseOrderByStoreIdDesc(Pageable pageable);
22+
Slice<Store> findAllByDeletedFalseOrderByStoreIdAsc(Pageable pageable);
2323
}

0 commit comments

Comments
 (0)