Skip to content

Commit

Permalink
[feat] config 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiwon committed Jul 25, 2023
1 parent e91b0dd commit 2d01d7f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()


.antMatchers("**/oath-processor/**","/kakaologin","/copy", "/copy/search","/copy/filter","/copy/crawling", "/brand", "/brand/{brand_id}"
.antMatchers("**/oath-processor/**","/kakaologin","/copy", "/copy/search","/copy/filter","/copy/crawling", "/brand", "/brand/{brand_id}","/example/login"

).permitAll()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ public class CopyController {


// 전체 카피라이팅 조회
// 페이지네이션 구현
@GetMapping("/{index}") //copy/0=> 0-30 copy/1=>0~30 copy/2=>60~90 copy/9 => 270~300
public HttpRes<List<CopyRes>> copyList(HttpServletRequest httpRequest,@PathVariable int index) {
Long[] brandIds = {2L, 3L, 4L, 12L, 15L, 17L, 21L, 24L, 25L, 28L};

List<CopyRes> tempCopyRes = new ArrayList<>();

for (Long brandId : brandIds) {
List<CopyRes> copyRes = copyService.getCopyList(brandId);
List<CopyRes> copyRes = copyService.getCopyList(brandId); //10개씩 -> 100개
tempCopyRes.addAll(copyRes);
}
Collections.shuffle(tempCopyRes);

Collections.shuffle(tempCopyRes); //섞임

// 요청한 index에 따라 30개의 다른 결과를 생성
int startIndex = index * 30;
int startIndex = index * 30; //인덱싱
List<CopyRes> resultCopyRes = getLimitedCopyResByIndex(tempCopyRes, startIndex);

setScrapCntWhenTokenNotProvided(httpRequest,resultCopyRes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ public interface CardRepository extends JpaRepository<Card, Long>{
List<Card> findByTextContaining(String q);


List<Card> findTop10ByBrandIdOrderByCreatedAtDesc(Long brandId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CopyService {

@Transactional
public List<CopyRes> getCopyList(Long brandId) {
List<Card> cards = cardRepository.findTop5ByBrandIdOrderByCreatedAtDesc(brandId);
List<Card> cards = cardRepository.findTop10ByBrandIdOrderByCreatedAtDesc(brandId);
List<CopyRes> copyResList = new ArrayList<>();

for (Card card : cards) {
Expand Down

0 comments on commit 2d01d7f

Please sign in to comment.