Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
afe4bb4
[feat] : ์ตœ๊ทผ ์ž…์ฐฐ๊ฐ€๋กœ ๊ฐ€๊ฒฉ ํ•„ํ„ฐ๋ง
hyun2371 Jun 15, 2025
96d91d3
[test] : ์ตœ๊ทผ ์ž…์ฐฐ๊ฐ€๋กœ ๊ฐ€๊ฒฉ ํ•„ํ„ฐ๋ง ํ…Œ์ŠคํŠธ ๋ฐ˜์˜
hyun2371 Jun 15, 2025
99c958d
[chore] : sql ํŒŒ์ผ ์ €์žฅ
hyun2371 Jun 16, 2025
75c2900
[chore] : ๊ฒฝ๋งค, ๊ฒฝ๋งค ๊ฒ€์ƒ‰ sql ์ €์žฅ
hyun2371 Jun 16, 2025
30d3eea
[feat] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ํ…Œ์ด๋ธ” ์ถ”๊ฐ€
hyun2371 Jun 16, 2025
b07f82d
[feat] : ๊ฒฝ๋งค ์ €์žฅ ์‹œ ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ๊ฐ™์ด ์ €์žฅ
hyun2371 Jun 16, 2025
a5a4bc7
[feat] : ์Šค์ผ€์ค„๋Ÿฌ๋กœ ํ†ต๊ณ„ ํ•„๋“œ ์—…๋ฐ์ดํŠธ
hyun2371 Jun 16, 2025
d01bb1d
[feat] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ๋™์  ์ฟผ๋ฆฌ ์ถ”๊ฐ€
hyun2371 Jun 16, 2025
7b339c3
[test] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ๋™์  ์ฟผ๋ฆฌ ํ…Œ์ŠคํŠธ
hyun2371 Jun 16, 2025
2c618eb
[feat] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ์„ฑ๋Šฅ ๊ฐœ์„  API ์ถ”๊ฐ€
hyun2371 Jun 16, 2025
6e82e20
[chore] : API ํ…Œ์ŠคํŠธ ํŒŒ์ผ ์ถ”๊ฐ€
hyun2371 Jun 16, 2025
f16ba71
[feat] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ํ…Œ์ด๋ธ” ๋™์  ์ฟผ๋ฆฌ ์ž‘์„ฑ
hyun2371 Jun 16, 2025
1e79a8a
[test] : ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ํ…Œ์ด๋ธ” ๋™์  ์ฟผ๋ฆฌ ํ…Œ์ŠคํŠธ
hyun2371 Jun 16, 2025
3b080b8
[feat] : ๊ฒฝ๋งค ์ถ”์ฒœ ์„ฑ๋Šฅ ๊ฐœ์„  API ์ถ”
hyun2371 Jun 16, 2025
f038a1a
[chore] : ๊ฒฝ๋งค ์ถ”์ฒœ ์„ฑ๋Šฅ ๊ฐœ์„  API ํ…Œ์ŠคํŠธ
hyun2371 Jun 16, 2025
a1540f7
[feat] : ๊ฒฝ๋งค ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”์ฒœ ๋™์  ์ฟผ๋ฆฌ ์ž‘
hyun2371 Jun 16, 2025
853fd77
[test] : ๊ฒฝ๋งค ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”์ฒœ ๋™์  ์ฟผ๋ฆฌ ํ…Œ์ŠคํŠธ
hyun2371 Jun 16, 2025
28b0a02
[feat] : ๊ฒฝ๋งค ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”์ฒœ ์„ฑ๋Šฅ ๊ฐœ์„  API ์ถ”๊ฐ€
hyun2371 Jun 16, 2025
2f31779
[test] : ๊ฒฝ๋งค ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”์ฒœ ์„ฑ๋Šฅ ๊ฐœ์„  API ํ…Œ์ŠคํŠธ
hyun2371 Jun 16, 2025
855fff7
[refactor] : ์ •๋ ฌ ๊ธฐ๋Šฅ ํ†ต
hyun2371 Jun 17, 2025
045a5ce
[test] : ๊ฒฝ๋งค ๋“ฑ๋ก ์‹œ ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ๋“ฑ๋ก ๋กœ์ง ๋ฐ˜์˜
hyun2371 Jun 17, 2025
029b792
[feat] : ๊ฒฝ๋งค, ๊ฒฝ๋งค ๊ฒ€์ƒ‰ ํŒจํ‚ค์ง€ ๋ถ„
hyun2371 Jun 17, 2025
480ad4b
[refactor] : ๋ถˆํ•„์š”ํ•œ ์™ธ๋ถ€ ์กฐ์ธ ์‚ญ์ œ
hyun2371 Jun 22, 2025
efbae1a
[chore] : sql, ์š”์ฒญ ํŒŒ์ผ ์ˆ˜์ •
hyun2371 Jun 22, 2025
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
@@ -1,23 +1,18 @@
package dev.handsup.auction.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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import dev.handsup.auction.dto.request.RegisterAuctionRequest;
import dev.handsup.auction.dto.response.AuctionDetailResponse;
import dev.handsup.auction.dto.response.RecommendAuctionResponse;
import dev.handsup.auction.service.AuctionService;
import dev.handsup.auth.annotation.NoAuth;
import dev.handsup.auth.jwt.JwtAuthorization;
import dev.handsup.common.dto.PageResponse;
import dev.handsup.user.domain.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand Down Expand Up @@ -54,32 +49,4 @@ public ResponseEntity<AuctionDetailResponse> getAuctionDetail(@PathVariable("auc
AuctionDetailResponse response = auctionService.getAuctionDetail(auctionId);
return ResponseEntity.ok(response);
}

@NoAuth
@Operation(summary = "๊ฒฝ๋งค ์ถ”์ฒœ API", description = "์ •๋ ฌ ์กฐ๊ฑด์— ๋”ฐ๋ผ ๊ฒฝ๋งค๋ฅผ ์ถ”์ฒœํ•œ๋‹ค.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/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 = auctionService.getRecommendAuctions(si, gu, dong, pageable);
return ResponseEntity.ok(response);
}

@Operation(summary = "์œ ์ € ์„ ํ˜ธ ์นดํ…Œ๊ณ ๋ฆฌ ๊ฒฝ๋งค ์กฐํšŒ API", description = "์œ ์ €๊ฐ€ ์„ ํ˜ธํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ฒฝ๋งค๋ฅผ ์กฐํšŒํ•œ๋‹ค.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/recommend/category")
public ResponseEntity<PageResponse<RecommendAuctionResponse>> getUserPreferredCategoryAuctions(
@Parameter(hidden = true) @JwtAuthorization User user,
Pageable pageable
) {
PageResponse<RecommendAuctionResponse> response = auctionService.getUserPreferredCategoryAuctions(user,
pageable);
return ResponseEntity.ok(response);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import dev.handsup.auction.dto.request.AuctionSearchCondition;
import dev.handsup.auction.dto.response.AuctionSimpleResponse;
import dev.handsup.auth.annotation.NoAuth;
import dev.handsup.common.dto.PageResponse;
import dev.handsup.search.dto.AuctionSearchCondition;
import dev.handsup.search.dto.AuctionSearchResponse;
import dev.handsup.search.dto.PopularKeywordsResponse;
import dev.handsup.search.service.SearchService;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -23,25 +22,35 @@
@Tag(name = "๊ฒ€์ƒ‰ API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/auctions/search")
public class SearchApiController {
private final SearchService searchService;

@NoAuth
@Operation(summary = "๊ฒฝ๋งค ๊ฒ€์ƒ‰ API", description = "๊ฒฝ๋งค๋ฅผ ๊ฒ€์ƒ‰ํ•œ๋‹ค")
@ApiResponse(useReturnTypeSchema = true)
@PostMapping
public ResponseEntity<PageResponse<AuctionSimpleResponse>> searchAuctions(
@PostMapping("/api/auctions/search")
public ResponseEntity<PageResponse<AuctionSearchResponse>> searchAuctions(
@Valid @RequestBody AuctionSearchCondition condition,
Pageable pageable) {
PageResponse<AuctionSimpleResponse> response = searchService.searchAuctions(condition, pageable);
PageResponse<AuctionSearchResponse> response = searchService.searchAuctions(condition, pageable);
return ResponseEntity.ok(response);
}

@NoAuth
@Operation(summary = "์ตœ์ ํ™”๋œ ๊ฒฝ๋งค ๊ฒ€์ƒ‰ API", description = "๊ฒฝ๋งค๋ฅผ ๊ฒ€์ƒ‰ํ•œ๋‹ค")
@ApiResponse(useReturnTypeSchema = true)
@PostMapping("/api/v2/auctions/search")
public ResponseEntity<PageResponse<AuctionSearchResponse>> searchAuctionsV2(
@Valid @RequestBody AuctionSearchCondition condition,
Pageable pageable) {
PageResponse<AuctionSearchResponse> response = searchService.searchAuctionsV2(condition, pageable);
return ResponseEntity.ok(response);
}

@NoAuth
@Operation(summary = "์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ API", description = "์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด๋ฅผ ์กฐํšŒํ•œ๋‹ค.")
@ApiResponse(useReturnTypeSchema = true)
@GetMapping("/popular")
@GetMapping("/api/auctions/search/popular")
public ResponseEntity<PopularKeywordsResponse> getPopularKeywords() {
PopularKeywordsResponse response = searchService.getPopularKeywords();
return ResponseEntity.ok(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;

import dev.handsup.auction.domain.Auction;
import dev.handsup.auction.domain.auction_field.PurchaseTime;
import dev.handsup.auction.domain.auction_field.TradeMethod;
import dev.handsup.auction.domain.auction_field.TradingLocation;
import dev.handsup.auction.domain.product.Product;
import dev.handsup.auction.domain.product.ProductStatus;
import dev.handsup.auction.domain.product.product_category.PreferredProductCategory;
import dev.handsup.auction.domain.product.product_category.ProductCategory;
import dev.handsup.auction.dto.request.RegisterAuctionRequest;
import dev.handsup.auction.exception.AuctionErrorCode;
import dev.handsup.auction.repository.auction.AuctionRepository;
import dev.handsup.auction.repository.product.PreferredProductCategoryRepository;
import dev.handsup.auction.repository.product.ProductCategoryRepository;
import dev.handsup.common.support.ApiTestSupport;
import dev.handsup.fixture.AuctionFixture;
Expand All @@ -42,9 +38,6 @@ class AuctionApiControllerTest extends ApiTestSupport {
@Autowired
private ProductCategoryRepository productCategoryRepository;

@Autowired
private PreferredProductCategoryRepository preferredProductCategoryRepository;

@BeforeEach
void setUp() {
productCategory = ProductFixture.productCategory(DIGITAL_DEVICE);
Expand Down Expand Up @@ -128,96 +121,4 @@ void getAuctionDetail() throws Exception {
.andExpect(jsonPath("$.tradeDong").value(tradingLocation.getDong()))
.andExpect(jsonPath("$.bookmarkCount").value(auction.getBookmarkCount()));
}

@DisplayName("[์ •๋ ฌ ์กฐ๊ฑด๊ณผ ์ง€์—ญ ํ•„ํ„ฐ์— ๋”ฐ๋ผ ๊ฒฝ๋งค๊ธ€ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.]")
@Test
void getRecommendAuctionsWithFilter() throws Exception {
//given
String si = "์„œ์šธ์‹œ", gu = "์„œ์ดˆ๊ตฌ", dong1 = "๋ฐฉ๋ฐฐ๋™", dong2 = "๋ฐ˜ํฌ๋™";
String earlyEndDate = "2024-03-02", lateEndDate = "2024-03-10";
Auction auction1 = AuctionFixture.auction(productCategory, lateEndDate, si, gu, dong1);
Auction auction2 = AuctionFixture.auction(productCategory, earlyEndDate, si, gu, dong1);
Auction auction3 = AuctionFixture.auction(productCategory, lateEndDate, si, gu, dong2);
auctionRepository.saveAll(List.of(auction1, auction2, auction3));

//when
mockMvc.perform(get("/api/auctions/recommend").param("sort", "๋งˆ๊ฐ์ผ")
.param("si", si)
.param("gu", gu)
.param("dong", dong1)
.contentType(APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.size").value(2))
.andExpect(jsonPath("$.content[0].auctionId").value(auction2.getId()))
.andExpect(jsonPath("$.content[0].endDate").value(auction2.getEndDate().atStartOfDay().toString()))
.andExpect(jsonPath("$.content[1].auctionId").value(auction1.getId()))
.andExpect(jsonPath("$.content[1].endDate").value(auction1.getEndDate().atStartOfDay().toString()))
.andExpect(jsonPath("$.hasNext").value(false));
}

@DisplayName("[์ •๋ ฌ ์กฐ๊ฑด์— ๋”ฐ๋ผ ๊ฒฝ๋งค๊ธ€ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.]")
@Test
void getRecommendAuctionsWithOutFilter() throws Exception {
//given
Auction auction1 = AuctionFixture.auction(productCategory);
Auction auction2 = AuctionFixture.auction(productCategory);
Auction auction3 = AuctionFixture.auction(productCategory);
auctionRepository.saveAll(List.of(auction1, auction2, auction3));

//when
mockMvc.perform(get("/api/auctions/recommend").param("sort", "์ตœ๊ทผ์ƒ์„ฑ").contentType(APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.size").value(3))
.andExpect(jsonPath("$.content[0].auctionId").value(auction3.getId()))
.andExpect(jsonPath("$.content[1].auctionId").value(auction2.getId()))
.andExpect(jsonPath("$.content[2].auctionId").value(auction1.getId()))
.andExpect(jsonPath("$.hasNext").value(false));
}

@DisplayName("[์ •๋ ฌ ์กฐ๊ฑด์ด ์—†์„ ์‹œ ์˜ˆ์™ธ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.]")
@Test
void getRecommendAuctions_fails() throws Exception {
mockMvc.perform(get("/api/auctions/recommend").contentType(APPLICATION_JSON))
.andDo(MockMvcResultHandlers.print())
.andExpect(jsonPath("$.message").value(AuctionErrorCode.EMPTY_SORT_INPUT.getMessage()))
.andExpect(jsonPath("$.code").value(AuctionErrorCode.EMPTY_SORT_INPUT.getCode()));
}

@DisplayName("[์ •๋ ฌ ์กฐ๊ฑด์ด ์ž˜๋ชป๋˜๋ฉด ์˜ˆ์™ธ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.]")
@Test
void getRecommendAuctions_fails2() throws Exception {
mockMvc.perform(get("/api/auctions/recommend").contentType(APPLICATION_JSON).param("sort", "NAN"))
.andDo(MockMvcResultHandlers.print())
.andExpect(jsonPath("$.message").value(AuctionErrorCode.INVALID_SORT_INPUT.getMessage()))
.andExpect(jsonPath("$.code").value(AuctionErrorCode.INVALID_SORT_INPUT.getCode()));
}

@DisplayName("[์œ ์ € ์„ ํ˜ธ ์นดํ…Œ๊ณ ๋ฆฌ ๊ฒฝ๋งค๋ฅผ ๋ถ๋งˆํฌ ์ˆœ์œผ๋กœ ์ •๋ ฌํ•œ๋‹ค.]")
@Test
void getUserPreferredCategoryAuctions() throws Exception {
ProductCategory productCategory2 = productCategoryRepository.save(ProductCategory.from("์ƒํ™œ/์ฃผ๋ฐฉ"));
ProductCategory notPreferredProductCategory = productCategoryRepository.save(ProductCategory.from("ํ‹ฐ์ผ“/๊ตํ™˜๊ถŒ"));

preferredProductCategoryRepository.saveAll(List.of(
PreferredProductCategory.of(user, productCategory),
PreferredProductCategory.of(user, productCategory2)
));
Auction auction1 = AuctionFixture.auction(productCategory);
ReflectionTestUtils.setField(auction1, "bookmarkCount", 3);
Auction auction2 = AuctionFixture.auction(productCategory2);
ReflectionTestUtils.setField(auction2, "bookmarkCount", 5);

Auction auction3 = AuctionFixture.auction(notPreferredProductCategory);
auctionRepository.saveAll(List.of(auction1, auction2, auction3));

//when
mockMvc.perform(get("/api/auctions/recommend/category")
.header(AUTHORIZATION, "Bearer " + accessToken)
.contentType(APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.size").value(2))
.andExpect(jsonPath("$.content[0].auctionId").value(auction2.getId()))
.andExpect(jsonPath("$.content[1].auctionId").value(auction1.getId()))
.andExpect(jsonPath("$.hasNext").value(false));
}
}
Loading