-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRecommendApiController.java
More file actions
82 lines (74 loc) · 3.57 KB
/
RecommendApiController.java
File metadata and controls
82 lines (74 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package dev.handsup.recommend.controller;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import dev.handsup.auth.annotation.NoAuth;
import dev.handsup.auth.jwt.JwtAuthorization;
import dev.handsup.common.dto.PageResponse;
import dev.handsup.recommend.dto.RecommendAuctionResponse;
import dev.handsup.recommend.service.RecommendService;
import dev.handsup.user.domain.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@Tag(name = "홈 추천 API")
@RestController
@RequiredArgsConstructor
public class RecommendApiController {
private final RecommendService recommendService;
@NoAuth
@Operation(summary = "경매 추천 API", description = "정렬 조건에 따라 경매를 추천한다.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/api/auctions/recommend")
@Cacheable(cacheNames = "auctions")
public ResponseEntity<PageResponse<RecommendAuctionResponse>> getRecommendAuctions(
@RequestParam(value = "si", required = false) String si,
@RequestParam(value = "gu", required = false) String gu,
@RequestParam(value = "dong", required = false) String dong,
Pageable pageable
) {
PageResponse<RecommendAuctionResponse> response = recommendService.getRecommendAuctions(si, gu, dong, pageable);
return ResponseEntity.ok(response);
}
@NoAuth
@Operation(summary = "성능 개선된 경매 추천 API", description = "정렬 조건에 따라 경매를 추천한다.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/api/v2/auctions/recommend")
@Cacheable(cacheNames = "auctions")
public ResponseEntity<PageResponse<RecommendAuctionResponse>> getRecommendAuctionsV2(
@RequestParam(value = "si", required = false) String si,
@RequestParam(value = "gu", required = false) String gu,
@RequestParam(value = "dong", required = false) String dong,
Pageable pageable
) {
PageResponse<RecommendAuctionResponse> response = recommendService.getRecommendAuctionsV2(si, gu, dong, pageable);
return ResponseEntity.ok(response);
}
@Operation(summary = "유저 선호 카테고리 경매 조회 API", description = "유저가 선호하는 카테고리의 경매를 조회한다.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/api/auctions/recommend/category")
public ResponseEntity<PageResponse<RecommendAuctionResponse>> getUserPreferredCategoryAuctions(
@Parameter(hidden = true) @JwtAuthorization User user,
Pageable pageable
) {
PageResponse<RecommendAuctionResponse> response = recommendService.getUserPreferredCategoryAuctions(user,
pageable);
return ResponseEntity.ok(response);
}
@Operation(summary = "성능 개선된 유저 선호 카테고리 경매 조회 API", description = "유저가 선호하는 카테고리의 경매를 조회한다.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/api/v2/auctions/recommend/category")
public ResponseEntity<PageResponse<RecommendAuctionResponse>> getUserPreferredCategoryAuctionsV2(
@Parameter(hidden = true) @JwtAuthorization User user,
Pageable pageable
) {
PageResponse<RecommendAuctionResponse> response = recommendService.getUserPreferredCategoryAuctionsV2(user,
pageable);
return ResponseEntity.ok(response);
}
}