diff --git a/build.gradle b/build.gradle index 3e8f5116..cda7bd9a 100644 --- a/build.gradle +++ b/build.gradle @@ -98,6 +98,8 @@ dependencies { testCompileOnly 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' + implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0' + //redisson implementation 'org.redisson:redisson-spring-boot-starter:3.18.0' diff --git a/src/main/java/com/midas/shootpointer/batch/reader/ranking/RankingReader.java b/src/main/java/com/midas/shootpointer/batch/reader/ranking/RankingReader.java index f27639a8..2e3d58e2 100644 --- a/src/main/java/com/midas/shootpointer/batch/reader/ranking/RankingReader.java +++ b/src/main/java/com/midas/shootpointer/batch/reader/ranking/RankingReader.java @@ -80,7 +80,6 @@ private PagingQueryProvider pagingQueryProvider(){ /** * 1. 시간 조건 - * + is_selected = true * + is_aggregation_agreed = true */ queryProvider.setSelectClause(""" @@ -103,7 +102,6 @@ private PagingQueryProvider pagingQueryProvider(){ queryProvider.setWhereClause(""" WHERE m.is_aggregation_agreed = true - AND h.is_selected = true AND h.created_at BETWEEN :begin AND :end """); diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/business/HighlightManager.java b/src/main/java/com/midas/shootpointer/domain/highlight/business/HighlightManager.java index fad87548..0f5475f8 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/business/HighlightManager.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/business/HighlightManager.java @@ -18,7 +18,9 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; import java.util.List; +import java.util.TreeMap; import java.util.UUID; @Component @@ -31,36 +33,6 @@ public class HighlightManager { private final HighlightFactory factory; private final MemberHelper memberHelper; - /*========================== - * - *HighlightManager - * 여러개의 하이라이트 영상 중 유저가 선택하는 메서드 - * @parm request : 요청 dto memberId : 멤버 Id - * @return 선택된 하이라이트 영상 Id 리스트 - * @author kimdoyeon - * @version 1.0.0 - * @date 25. 10. 7. - * - ==========================**/ - @Transactional - @CustomLog - public HighlightSelectResponse selectHighlight(HighlightSelectRequest request, Member member){ - List selectedIds=request.getSelectedHighlightIds(); - /** - * 1. 유저가 선택 요청한 하이라이트 Id 리스트 -> 엔티티로 가져오기 - */ - List highlights = selectedIds.stream() - .map(highlightHelper::findHighlightByHighlightId) - .toList(); - - /* - * 2. 선택 수행 - */ - highlights.forEach(entity -> entity.select(member)); - - return mapper.entityToResponse(selectedIds); - } - /*========================== * *HighlightManager @@ -89,7 +61,7 @@ public void saveHighlights(HighlightRequest request, UUID memberId) { /* * 2. 하이라이트 엔티티 생성 */ - List entities=factory.createHighlightEntities(request.getHighlightUrls(),request.getHighlightIdentifier(),member,backNumber); + List entities=factory.createHighlightEntities(request.getHighlightUrls(),request.getHighlightIdentifier(),member,backNumber,request.getCreatedAt()); /* 3. DB 저장 @@ -118,4 +90,28 @@ public List fetchAllMembersHighlights(String period){ PeriodType convertedType=PeriodType.valueOf(period); return highlightHelper.fetchAllMembersHighlights(convertedType); } + + public HighlightCalendarResponse fetchCalendar(int year, int month,UUID memberId) { + /** + * 1. year,month 입력 값 검증 + */ + highlightHelper.isValidDateRange(year,month); + + /** + * 2.년 월 기간 내 생성된 하이라이트 영상 조회 - flat data 조회 + */ + List flatHighlightList=highlightHelper.fetchFlatHighlightList(year,month,memberId); + + /** + * 3. flat data 그룹핑한 데이터 조회 + */ + TreeMap> groupingHighlights=highlightHelper.groupingHighlights(flatHighlightList); + + /** + * 4.date와 매핑된 데이터 반환 + */ + List daysResponses=mapper.groupingHighlightToDaysResponse(groupingHighlights); + + return new HighlightCalendarResponse(year,month,daysResponses); + } } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandService.java b/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandService.java index 53235cc8..a3ba3115 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandService.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandService.java @@ -1,15 +1,9 @@ package com.midas.shootpointer.domain.highlight.business.command; import com.midas.shootpointer.domain.highlight.dto.HighlightRequest; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectRequest; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; -import com.midas.shootpointer.domain.member.entity.Member; import java.util.UUID; public interface HighlightCommandService { - HighlightSelectResponse selectHighlight(HighlightSelectRequest request, Member member); - void uploadHighlights(HighlightRequest highlights, UUID memberId); } -//// \ No newline at end of file diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImpl.java b/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImpl.java index d68e5ea7..0ecbebee 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImpl.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImpl.java @@ -16,21 +16,6 @@ @Slf4j public class HighlightCommandServiceImpl implements HighlightCommandService { private final HighlightManager manager; - /*========================== - * - *HighlightCommandServiceImpl - * - * @parm HighlightSelectRequest : 하이라이트 선택 요청 Dto , token : JWT - * @return 하이라이트 선택 성공 시 선택한 하이라이트 id 반환 dto - * @author kimdoyeon - * @version 1.0.0 - * @date 6/23/25 - * - ==========================**/ - @Override - public HighlightSelectResponse selectHighlight(HighlightSelectRequest request, Member member) { - return manager.selectHighlight(request,member); - } /*========================== * diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightCommandController.java b/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightCommandController.java index 3bf8f748..2ba4c40a 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightCommandController.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightCommandController.java @@ -2,11 +2,7 @@ import com.midas.shootpointer.domain.highlight.business.command.HighlightCommandService; import com.midas.shootpointer.domain.highlight.dto.HighlightRequest; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectRequest; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; -import com.midas.shootpointer.domain.member.entity.Member; import com.midas.shootpointer.global.dto.ApiResponse; -import com.midas.shootpointer.global.security.SecurityUtils; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -24,15 +20,6 @@ public class HighlightCommandController { private final HighlightCommandService highlightCommandService; - @PostMapping("/select") - public ResponseEntity> selectHighlight( - @RequestBody HighlightSelectRequest request - ) { - Member member = SecurityUtils.getCurrentMember(); - - return ResponseEntity.ok(ApiResponse.ok(highlightCommandService.selectHighlight(request, member))); - } - @Operation( summary = "하이라이트 URL 전송 API (OpenCV 에서 사용) - [담당자 : 김도연]", responses = { diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightQueryController.java b/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightQueryController.java index 31a61951..af481997 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightQueryController.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/controller/HighlightQueryController.java @@ -1,6 +1,7 @@ package com.midas.shootpointer.domain.highlight.controller; import com.midas.shootpointer.domain.highlight.business.HighlightManager; +import com.midas.shootpointer.domain.highlight.dto.HighlightCalendarResponse; import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse; import com.midas.shootpointer.global.dto.ApiResponse; @@ -31,8 +32,26 @@ public ResponseEntity>> highlightList( return ResponseEntity.ok(ApiResponse.ok( manager.listByPaging(page,size,memberId))); } + /** + * @param period WEEKLY : 이번 주 / MONTHLY : 이번 달 + * @return 이번 주 / 이번 달 인기 하이라이트 조회 + */ @GetMapping public ResponseEntity>> periodHighlight(@RequestParam(value = "period")String period){ return ResponseEntity.ok(ApiResponse.ok(manager.fetchAllMembersHighlights(period))); } + + /** + * @param year 조회 연도 + * @param month 조회 달 + * @return 캘린더형 유저의 날짜별 하이라이트 영상 리스트 조회 + */ + @GetMapping("/calendar") + public ResponseEntity> fetchCalendar( + @RequestParam(value = "year") int year, + @RequestParam(value = "month")int month + ){ + UUID memberId=SecurityUtils.getCurrentMemberId(); + return ResponseEntity.ok(ApiResponse.ok(manager.fetchCalendar(year,month,memberId))); + } } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/dto/DateTimeRange.java b/src/main/java/com/midas/shootpointer/domain/highlight/dto/DateTimeRange.java new file mode 100644 index 00000000..4ca6f9c0 --- /dev/null +++ b/src/main/java/com/midas/shootpointer/domain/highlight/dto/DateTimeRange.java @@ -0,0 +1,6 @@ +package com.midas.shootpointer.domain.highlight.dto; + +import java.time.LocalDateTime; + +public record DateTimeRange(LocalDateTime start,LocalDateTime end) { +} diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarDaysResponse.java b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarDaysResponse.java new file mode 100644 index 00000000..69651ea9 --- /dev/null +++ b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarDaysResponse.java @@ -0,0 +1,13 @@ +package com.midas.shootpointer.domain.highlight.dto; + +import jakarta.validation.constraints.NotNull; + +import java.time.LocalDate; +import java.util.List; + +public record HighlightCalendarDaysResponse( + @NotNull LocalDate date, + @NotNull Integer count, + @NotNull List highlights +) { +} diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarResponse.java b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarResponse.java new file mode 100644 index 00000000..328b3e76 --- /dev/null +++ b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightCalendarResponse.java @@ -0,0 +1,13 @@ +package com.midas.shootpointer.domain.highlight.dto; + +import jakarta.validation.constraints.NotNull; + +import java.util.List; + +public record HighlightCalendarResponse( + @NotNull Integer year, + @NotNull Integer month, + @NotNull List days +) { +} + diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightSelectRequest.java b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightSelectRequest.java index d3a8c061..1f9c7f26 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightSelectRequest.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/dto/HighlightSelectRequest.java @@ -1,14 +1,12 @@ package com.midas.shootpointer.domain.highlight.dto; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import java.util.List; import java.util.UUID; @AllArgsConstructor @@ -18,9 +16,8 @@ @Schema(description = "하이라이트 선택 요청 DTO 입니다.") public class HighlightSelectRequest { /** - * 3가지 중 2개 선택 + * 게시물 - 3가지 중 1개 선택 */ - @NotEmpty - @Size(min = 2,max = 2,message = "하이라이트를 정확히 2개를 선택해주세요.") - private List selectedHighlightIds; + @NotNull + private UUID selectedHighlightIds; } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntity.java b/src/main/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntity.java index 5724e71f..1d1e7e8a 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntity.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntity.java @@ -2,9 +2,7 @@ import com.midas.shootpointer.domain.backnumber.entity.BackNumberEntity; import com.midas.shootpointer.domain.member.entity.Member; -import com.midas.shootpointer.global.common.ErrorCode; import com.midas.shootpointer.global.entity.BaseEntity; -import com.midas.shootpointer.global.exception.CustomException; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Builder; @@ -13,6 +11,7 @@ import lombok.extern.slf4j.Slf4j; import org.hibernate.annotations.UuidGenerator; +import java.time.LocalDateTime; import java.util.UUID; @Entity @@ -34,10 +33,6 @@ public class HighlightEntity extends BaseEntity { @Column(name = "highlight_key",nullable = false,columnDefinition = "uuid") private UUID highlightKey; - @Column(name = "is_selected") - @Builder.Default - private Boolean isSelected=false; - @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id",nullable = false, columnDefinition = "uuid") private Member member; @@ -55,20 +50,12 @@ public class HighlightEntity extends BaseEntity { @Builder.Default private Integer threePointCount=0; + @Column(name = "video_created_at") + private LocalDateTime videoCreatedAt; + /* =========== [ 도메인-행위 ] ============== */ - public void select(Member actor){ - //유저의 하이라이트 영상이 아닌경우 - if (!actor.getMemberId().equals(member.getMemberId())){ - throw new CustomException(ErrorCode.IS_NOT_CORRECT_MEMBERS_HIGHLIGHT_ID); - } - //이미 선택된 하이라이트 영상인 경우 - if (Boolean.TRUE.equals(this.isSelected)){ - throw new CustomException(ErrorCode.EXISTED_SELECTED); - } - this.isSelected=true; - } //2점 슛 계산 public int totalTwoPoint(){ diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightHelperImpl.java b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightHelperImpl.java index 2d110fd0..2e413060 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightHelperImpl.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightHelperImpl.java @@ -1,5 +1,7 @@ package com.midas.shootpointer.domain.highlight.helper; +import com.midas.shootpointer.domain.highlight.dto.DateTimeRange; +import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodType; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; @@ -9,8 +11,10 @@ import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; +import java.util.TreeMap; import java.util.UUID; @Component @@ -44,13 +48,23 @@ public List fetchAllMembersHighlights(PeriodType period } @Override - public LocalDateTime calculateStartDate(PeriodType type, LocalDateTime now) { - return highlightUtil.calculateStartDate(type,now); + public DateTimeRange calculateDateTimeRange(PeriodType type, LocalDateTime now) { + return highlightUtil.calculateDateTimeRange(type,now); } @Override - public LocalDateTime calculateEndDate(PeriodType type, LocalDateTime now) { - return highlightUtil.calculateEndDate(type,now); + public TreeMap> groupingHighlights(List flatHighlightList) { + return highlightUtil.groupingHighlights(flatHighlightList); + } + + @Override + public List fetchFlatHighlightList(int year, int month, UUID memberId) { + return highlightUtil.fetchFlatHighlightList(year,month,memberId); + } + + @Override + public DateTimeRange getMonthDateTimeRange(int year, int month) { + return highlightUtil.getMonthDateTimeRange(year,month); } @Override @@ -87,4 +101,9 @@ public boolean isExistDirectory(String directory) { public void areValidFiles(List files) { highlightValidator.areValidFiles(files); } + + @Override + public void isValidDateRange(int year, int month) { + highlightValidator.isValidDateRange(year,month); + } } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtil.java b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtil.java index 945aa86b..d19b9341 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtil.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtil.java @@ -1,13 +1,17 @@ package com.midas.shootpointer.domain.highlight.helper; +import com.midas.shootpointer.domain.highlight.dto.DateTimeRange; +import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodType; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; +import java.util.TreeMap; import java.util.UUID; public interface HighlightUtil { @@ -16,6 +20,8 @@ public interface HighlightUtil { List savedAll(List entities); Page fetchMembersHighlights(UUID memberId, Pageable pageable); List fetchAllMembersHighlights(PeriodType period); - LocalDateTime calculateStartDate(PeriodType type,LocalDateTime now); - LocalDateTime calculateEndDate(PeriodType type,LocalDateTime now); + DateTimeRange calculateDateTimeRange(PeriodType type,LocalDateTime now); + TreeMap> groupingHighlights(List flatHighlightList); + List fetchFlatHighlightList(int year,int month,UUID memberId); + DateTimeRange getMonthDateTimeRange(int year, int month); } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtilImpl.java b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtilImpl.java index 47ba129b..4d3a1e8d 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtilImpl.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightUtilImpl.java @@ -1,5 +1,7 @@ package com.midas.shootpointer.domain.highlight.helper; +import com.midas.shootpointer.domain.highlight.dto.DateTimeRange; +import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodType; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; @@ -19,9 +21,9 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.DayOfWeek; +import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; +import java.util.*; @Component @Slf4j @@ -77,52 +79,88 @@ public Page fetchMembersHighlights(UUID memberId, Pageable page @Override public List fetchAllMembersHighlights(PeriodType period) { LocalDateTime now=LocalDateTime.now(); - LocalDateTime startDate=calculateStartDate(period,now); - LocalDateTime endDate=calculateEndDate(period,now); + LocalDateTime startDate=calculateDateTimeRange(period,now).start(); + LocalDateTime endDate=calculateDateTimeRange(period,now).end(); Pageable page= PageRequest.of(0,HIGHLIGHT_SIZE); return highlightQueryRepository.fetchPeriodHighlight(startDate,endDate,FETCH_SIZE,page); } + /** + * @param flatHighlightList 년 월 기간 내 생성된 하이라이트 영상 목록 + * @return LocalDate(ex. 2022-10-22T) 형태로 그룹핑 + */ @Override - public LocalDateTime calculateStartDate(PeriodType type,LocalDateTime now) { - switch (type){ - case MONTHLY -> { - return now.withDayOfMonth(1).toLocalDate().atStartOfDay(); - } - case WEEKLY -> { - return now - .with(DayOfWeek.MONDAY) - .toLocalDate() - .atStartOfDay(); - } - case DAILY -> { - return now.toLocalDate() - .atStartOfDay(); - } - default -> throw new IllegalArgumentException("LocalDateTime 지원하지 않는 타입"); + public TreeMap> groupingHighlights(List flatHighlightList) { + TreeMap> results=new TreeMap<>(); + + for (HighlightInfoResponse response:flatHighlightList){ + //LocalDateTime -> LocalDate + LocalDate date=response.createdDate().toLocalDate(); + + //key 매핑 + results.putIfAbsent(date,new ArrayList<>()); + + //value 삽입 + results.get(date).add(response); } + + //flatHighlightList는 오름차순으로 정렬되어 반환되므로 따로 정렬할 필요 없음. + return results; } + /** + * @param year 연도 + * @param month 달 + * @param memberId 멤버 ID + * @return 유저의 입력된 년 월 기간 내 생성된 하이라이트 영상 조회 + */ @Override - public LocalDateTime calculateEndDate(PeriodType type,LocalDateTime now) { + public List fetchFlatHighlightList(int year, int month,UUID memberId) { + DateTimeRange range=getMonthDateTimeRange(year,month); + return highlightQueryRepository.fetchFlatHighlights(range.start(),range.end(),memberId); + } + + @Override + public DateTimeRange calculateDateTimeRange(PeriodType type, LocalDateTime now) { + LocalDateTime start; + LocalDateTime end; + switch (type){ case MONTHLY -> { - return now.withDayOfMonth(now.toLocalDate().lengthOfMonth()) + start= now.withDayOfMonth(1).toLocalDate().atStartOfDay(); + end=now.withDayOfMonth(now.toLocalDate().lengthOfMonth()) .toLocalDate() .atTime(23,59,59); } case WEEKLY -> { - return now.with(DayOfWeek.SUNDAY) + start=now + .with(DayOfWeek.MONDAY) + .toLocalDate() + .atStartOfDay(); + end=now.with(DayOfWeek.SUNDAY) .toLocalDate() .atTime(23,59,59); } case DAILY -> { - return now.toLocalDate() + start= now.toLocalDate() + .atStartOfDay(); + end= now.toLocalDate() .atTime(23,59,59); } default -> throw new IllegalArgumentException("LocalDateTime 지원하지 않는 타입"); } + return new DateTimeRange(start,end); + } + + @Override + public DateTimeRange getMonthDateTimeRange(int year, int month) { + LocalDate startDate = LocalDate.of(year, month, 1); + LocalDate endDate = startDate.withDayOfMonth(startDate.lengthOfMonth()); + + LocalDateTime start = startDate.atStartOfDay(); + LocalDateTime end = endDate.atTime(23, 59, 59); + return new DateTimeRange(start,end); } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidator.java b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidator.java index 3a7bf828..50265ecf 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidator.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidator.java @@ -13,4 +13,5 @@ public interface HighlightValidator { void isValidFileSize(MultipartFile file); boolean isExistDirectory(String directory); void areValidFiles(List files); + void isValidDateRange(int year,int month); } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidatorImpl.java b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidatorImpl.java index 13a6209f..31dc3e84 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidatorImpl.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/helper/HighlightValidatorImpl.java @@ -27,6 +27,11 @@ public class HighlightValidatorImpl implements HighlightValidator{ private static final long MAX_FILE_SIZE = 500L * 1024L * 1024L; private final HighlightQueryRepository highlightQueryRepository; + private static final int MAX_YEAR=2100; + private static final int MIN_YEAR=2000; + + private static final int JANUARY=1; + private static final int DECEMBER=12; @Override public boolean filesExist(String directory) { Path directoryPath= Paths.get(directory); @@ -87,4 +92,10 @@ public void areValidFiles(List files) { isValidMp4File(file); }); } + + @Override + public void isValidDateRange(int year, int month) { + if(year>MAX_YEAR || yearDECEMBER) throw new CustomException(ErrorCode.INVALID_MONTH); + } } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactory.java b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactory.java index d26a3bd9..95ddf587 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactory.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactory.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; import java.util.List; import java.util.UUID; @@ -19,7 +20,8 @@ public class HighlightFactory { public List createHighlightEntities(List highlightInfos, UUID key, Member member, - BackNumberEntity backNumber + BackNumberEntity backNumber, + LocalDateTime createAt ){ return highlightInfos.stream() .map(info -> HighlightEntity.builder() @@ -29,6 +31,7 @@ public List createHighlightEntities(List highlig .twoPointCount(info.twoPointCount()) .threePointCount(info.threePointCount()) .backNumber(backNumber) + .videoCreatedAt(createAt) .build()) .toList(); } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapper.java b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapper.java index 1ee71489..a55bf38f 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapper.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapper.java @@ -1,13 +1,17 @@ package com.midas.shootpointer.domain.highlight.mapper; +import com.midas.shootpointer.domain.highlight.dto.HighlightCalendarDaysResponse; import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; +import java.time.LocalDate; import java.util.List; +import java.util.TreeMap; import java.util.UUID; public interface HighlightMapper { HighlightSelectResponse entityToResponse(List selectedHighlights); HighlightInfoResponse infoResponseToEntity(HighlightEntity entity); + List groupingHighlightToDaysResponse(TreeMap> groupingHighlights); } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImpl.java b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImpl.java index 66cba5dd..50ede7a1 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImpl.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImpl.java @@ -1,11 +1,15 @@ package com.midas.shootpointer.domain.highlight.mapper; +import com.midas.shootpointer.domain.highlight.dto.HighlightCalendarDaysResponse; import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; import org.springframework.stereotype.Component; +import java.time.LocalDate; +import java.util.ArrayList; import java.util.List; +import java.util.TreeMap; import java.util.UUID; @Component @@ -23,5 +27,17 @@ public HighlightInfoResponse infoResponseToEntity(HighlightEntity entity) { return HighlightInfoResponse.of(entity.getHighlightId(),entity.getCreatedAt(),entity.totalTwoPoint(),entity.totalThreePoint(),entity.getHighlightURL()); } + @Override + public List groupingHighlightToDaysResponse(TreeMap> groupingHighlights) { + List calendarDaysResponses=new ArrayList<>(); + + for (LocalDate date:groupingHighlights.keySet()){ + List daysResponse=groupingHighlights.get(date); + + calendarDaysResponses.add(new HighlightCalendarDaysResponse(date,daysResponse.size(),daysResponse)); + } + return calendarDaysResponses; + } + } diff --git a/src/main/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepository.java b/src/main/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepository.java index 4fdf324e..5f047ca3 100644 --- a/src/main/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepository.java +++ b/src/main/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepository.java @@ -1,5 +1,7 @@ package com.midas.shootpointer.domain.highlight.repository; +import com.midas.shootpointer.domain.highlight.dto.HighlightCalendarDaysResponse; +import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; import com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; import org.springframework.data.domain.Page; @@ -37,12 +39,14 @@ public interface HighlightQueryRepository extends JpaRepository fetchAllMembersHighlights(@Param("memberId") UUID memberId, Pageable pageable); + /** + * 기간 내에 눌린 좋아요 개수 기준으로 내림차순으로 인기 하이라이트 조회. + */ @Query(value = """ SELECT DISTINCT new com.midas.shootpointer.domain.highlight.dto.PeriodHighlightResponse @@ -63,12 +67,41 @@ public interface HighlightQueryRepository extends JpaRepository fetchPeriodHighlight(LocalDateTime startDate, LocalDateTime endDate, int limit,Pageable page); + /** + * 캘린더형 유저의 하이라이트 영상 목록 조회 + */ + @Query(value = """ + SELECT + new com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse( + h.highlightId, + h.createdAt, + h.twoPointCount * 2 , + h.threePointCount * 3 , + h.highlightURL + ) + FROM + HighlightEntity AS h + WHERE + h.member.memberId = :memberId + AND + h.createdAt BETWEEN :startDate AND :endDate + ORDER BY + h.videoCreatedAt ASC + """ ) + List fetchFlatHighlights(LocalDateTime startDate,LocalDateTime endDate,UUID memberId); /** * =========================== *

@@ -77,14 +110,14 @@ public interface HighlightQueryRepository extends JpaRepository repositoryAll = postQueryRepository.findAllWithMemberAndHighlight(); // PostEntity → PostDocument 변환 - List docs = repositoryAll.stream() + /*List docs = repositoryAll.stream() .map(mapper::entityToDoc) .toList(); postElasticSearchRepository.saveAll(docs); - System.out.println("ES - 삽입 완료"); + System.out.println("ES - 삽입 완료");*/ } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ddcb2ec4..c1f80b4d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,6 +16,9 @@ jwt: refresh_expiration_time: 259200000 spring: + output: + ansi: + enabled: always jackson: serialization: write-dates-as-timestamps: false @@ -134,7 +137,9 @@ management: endpoint: health: show-details: always - + health: + elasticsearch: + enabled: false #Kakao kakao: auth: @@ -187,4 +192,4 @@ sse: ttl: 1800000 event-name: progress cache-max-size: 360 - clean-up-interval: 60000 \ No newline at end of file + clean-up-interval: 60000 diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..a0375ed1 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,14 @@ + + + + + + ${CONSOLE_LOG_PATTERN} + + + + + + + diff --git a/src/main/resources/query/ranking.sql b/src/main/resources/query/ranking.sql index 52b37b02..f198cece 100644 --- a/src/main/resources/query/ranking.sql +++ b/src/main/resources/query/ranking.sql @@ -13,7 +13,6 @@ WITH filtered AS ( member AS m ON h.member_id = m.member_id WHERE m.is_aggregation_agreed = TRUE - AND h.is_selected = TRUE AND h.created_at >= ? AND h.created_at < ? ) diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/business/HighlightManagerTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/business/HighlightManagerTest.java index f039e959..f488a658 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/business/HighlightManagerTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/business/HighlightManagerTest.java @@ -1,8 +1,6 @@ package com.midas.shootpointer.domain.highlight.business; import com.midas.shootpointer.domain.highlight.dto.HighlightInfoResponse; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectRequest; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; import com.midas.shootpointer.domain.highlight.entity.HighlightEntity; import com.midas.shootpointer.domain.highlight.repository.HighlightCommandRepository; import com.midas.shootpointer.domain.member.entity.Member; @@ -20,7 +18,6 @@ import java.nio.file.Path; import java.time.LocalDateTime; -import java.util.List; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -56,41 +53,6 @@ void cleanUp(){ repository.deleteAll(); } - @Test - @DisplayName("하이라이트 영상 객체를 호출하고 가져온 하이라이트 영상의 is_selected를 true 상태로 변환합니다.") - void selectHighlight(){ - //given - //하이라이트 영상 URL 저장 - UUID highlightKey=UUID.randomUUID(); - Member member=memberCommandRepository.save(makeMember()); - List highlightEntities=List.of( - makeHighlightEntity("url",highlightKey,member), - makeHighlightEntity("url",highlightKey,member), - makeHighlightEntity("url",highlightKey,member) - ); - highlightEntities=repository.saveAll(highlightEntities); - List selectedIds=highlightEntities.stream() - .map(HighlightEntity::getHighlightId) - .toList(); - - HighlightSelectRequest request=HighlightSelectRequest.builder() - .selectedHighlightIds(selectedIds) - .build(); - - - //when - HighlightSelectResponse response=highlightManager.selectHighlight(request,member); - - //then - assertThat(response).isNotNull(); - assertThat(response.getSelectedHighlightIds()).hasSize(3); - assertThat(response.getSelectedHighlightIds().get(0)).isEqualTo(selectedIds.get(0)); - assertThat(response.getSelectedHighlightIds().get(1)).isEqualTo(selectedIds.get(1)); - assertThat(response.getSelectedHighlightIds().get(2)).isEqualTo(selectedIds.get(2)); - - } - - @Test @DisplayName("실제 하이라이트 영상을 저장하고 엔티티를 DB에 저장한 후 DTO로 변환합니다.") void uploadHighlights(){ @@ -113,7 +75,6 @@ void listByPagingHighlights(){ HighlightEntity entity=HighlightEntity.builder() .highlightKey(UUID.randomUUID()) .highlightURL("https://cdn.example.com/video" + i + ".mp4") - .isSelected(true) .member(member) .build(); entity.setCreatedAt(LocalDateTime.now().minusDays(i)); diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImplTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImplTest.java index 1f8c6f79..2201928e 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImplTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/business/command/HighlightCommandServiceImplTest.java @@ -1,21 +1,11 @@ package com.midas.shootpointer.domain.highlight.business.command; import com.midas.shootpointer.domain.highlight.business.HighlightManager; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectRequest; -import com.midas.shootpointer.domain.member.entity.Member; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import java.util.List; -import java.util.UUID; - -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - @ExtendWith(MockitoExtension.class) class HighlightCommandServiceImplTest { @InjectMocks @@ -24,25 +14,4 @@ class HighlightCommandServiceImplTest { @Mock private HighlightManager highlightManager; - @DisplayName("manager.selectHighlight(HighlightSelectRequest, Member)가 실행되는지 검증합니다.") - @Test - void selectHighlight(){ - //given - HighlightSelectRequest request=HighlightSelectRequest.builder() - .selectedHighlightIds(List.of(UUID.randomUUID())) - .build(); - Member member=Member.builder() - .memberId(UUID.randomUUID()) - .username("test") - .email("test@naver.com") - .build(); - - //when - commandService.selectHighlight(request,member); - - //then - verify(highlightManager, times(1)).selectHighlight(request,member); - } - - } diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/controller/HighlightControllerTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/controller/HighlightControllerTest.java index 9f1dd914..dd4fb0fc 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/controller/HighlightControllerTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/controller/HighlightControllerTest.java @@ -3,28 +3,16 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.midas.shootpointer.WithMockCustomMember; import com.midas.shootpointer.domain.highlight.business.HighlightManager; -import com.midas.shootpointer.domain.highlight.dto.HighlightSelectRequest; import com.midas.shootpointer.domain.highlight.dto.HighlightSelectResponse; -import com.midas.shootpointer.domain.member.entity.Member; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import java.util.List; import java.util.UUID; - -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.mockito.Mockito.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @AutoConfigureMockMvc @SpringBootTest @ActiveProfiles("test") @@ -40,39 +28,6 @@ class HighlightCommandControllerTest { private HighlightManager manager; - @Test - @DisplayName("하이라이트 영상 선택 POST 요청 성공시 HighlightSelectResponse를 반환합니다._SUCCESS") - void selectHighlight() throws Exception { - //given - String url="/api/highlight/select"; - - UUID highlight1=UUID.randomUUID(); - UUID highlight2=UUID.randomUUID(); - - List uuids=List.of(highlight1,highlight2); - HighlightSelectResponse expectedResponse=mockHighlightSelectResponse(uuids); - HighlightSelectRequest request=mockHighlightSelectRequest(uuids); - - when(manager.selectHighlight(any(HighlightSelectRequest.class),any(Member.class))) - .thenReturn(expectedResponse); - - //when & then - mockMvc.perform(post(url) - .content(objectMapper.writeValueAsString(request)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.status").value("OK")) - .andExpect(jsonPath("$.success").value(true)) - .andExpect(jsonPath("$.data.selectedHighlightIds",containsInAnyOrder( - highlight1.toString(), - highlight2.toString() - ))) - .andDo(print()); - - verify(manager).selectHighlight(any(HighlightSelectRequest.class),any(Member.class)); - } - - private HighlightSelectResponse mockHighlightSelectResponse(List uuids){ @@ -80,14 +35,4 @@ private HighlightSelectResponse mockHighlightSelectResponse(List uuids){ .selectedHighlightIds(uuids) .build(); } - - /* - * Mock HighlightSelectRequest - */ - - private HighlightSelectRequest mockHighlightSelectRequest(List uuids){ - return HighlightSelectRequest.builder() - .selectedHighlightIds(uuids) - .build(); - } } diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntityTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntityTest.java index 8ab38dee..5b1cd287 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntityTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/entity/HighlightEntityTest.java @@ -1,97 +1,14 @@ package com.midas.shootpointer.domain.highlight.entity; import com.midas.shootpointer.domain.member.entity.Member; -import com.midas.shootpointer.global.common.ErrorCode; -import com.midas.shootpointer.global.exception.CustomException; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; class HighlightEntityTest { - @Test - @DisplayName("유저의 하이라이트 영상이 아닌 경우 IS_NOT_CORRECT_MEMBERS_HIGHLIGHT_ID 예외를 반환합니다.") - void select_IS_NOT_USERS_HIGHLIGHT(){ - //given - UUID memberId1=UUID.randomUUID(); - UUID memberId2=UUID.randomUUID(); - - Member member1=Member.builder() - .email("test@naver.com") - .username("test") - .memberId(memberId1) - .build(); - Member member2=Member.builder() - .email("test2@naver.com") - .username("test2") - .memberId(memberId2) - .build(); - - HighlightEntity highlight=HighlightEntity.builder() - .member(member1) - .highlightKey(UUID.randomUUID()) - .highlightURL("url") - .build(); - - //when & then - assertThatThrownBy(() -> highlight.select(member2)) - .isInstanceOf(CustomException.class) - .hasMessageContaining(ErrorCode.IS_NOT_CORRECT_MEMBERS_HIGHLIGHT_ID.getMessage()); - } - - @Test - @DisplayName("이미 선택된 하이라이트인 경우 EXISTED_SELECTED 예외를 발생시킵니다.") - void select_EXIST_SELECTED(){ - //given - UUID memberId=UUID.randomUUID(); - - Member member=Member.builder() - .email("test@naver.com") - .username("test") - .memberId(memberId) - .build(); - - HighlightEntity highlight=HighlightEntity.builder() - .member(member) - .highlightKey(UUID.randomUUID()) - .highlightURL("url") - .isSelected(true) - .build(); - - //when & then - assertThatThrownBy(() -> highlight.select(member)) - .isInstanceOf(CustomException.class) - .hasMessageContaining(ErrorCode.EXISTED_SELECTED.getMessage()); - - } - - @Test - @DisplayName("select 메서드 실행 시 isSelected가 True로 변환됩니다.") - void select(){ - //given - UUID memberId=UUID.randomUUID(); - - Member member=Member.builder() - .email("test@naver.com") - .username("test") - .memberId(memberId) - .build(); - - HighlightEntity highlight=HighlightEntity.builder() - .member(member) - .highlightKey(UUID.randomUUID()) - .highlightURL("url") - .build(); - - //when - highlight.select(member); - - //then - assertThat(highlight.getIsSelected()).isTrue(); - } @Test @DisplayName("하이라이트 객체의 2점 슛 총합계를 계산합니다.") diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactoryTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactoryTest.java index 91571737..ee743ebe 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactoryTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightFactoryTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import java.time.LocalDateTime; import java.util.List; import java.util.UUID; @@ -47,9 +48,9 @@ void createHighlightEntities(){ BackNumberEntity backNumber=BackNumberEntity.builder() .backNumber(BackNumber.of(10)) .build(); - + LocalDateTime now=LocalDateTime.now(); //when - List result=factory.createHighlightEntities(highlightInfos,highlightKey,member,backNumber); + List result=factory.createHighlightEntities(highlightInfos,highlightKey,member,backNumber,now); //then diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImplTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImplTest.java index e09451f2..4955cab3 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImplTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/mapper/HighlightMapperImplTest.java @@ -46,7 +46,6 @@ void infoResponseToEntity(){ .highlightURL("url") .highlightKey(highlightKey) .highlightId(highlightId) - .isSelected(true) .twoPointCount(20) .threePointCount(30) .build(); diff --git a/src/test/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepositoryTest.java b/src/test/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepositoryTest.java index 8036a249..10d4e407 100644 --- a/src/test/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepositoryTest.java +++ b/src/test/java/com/midas/shootpointer/domain/highlight/repository/HighlightQueryRepositoryTest.java @@ -145,7 +145,6 @@ void fetchAllMembersHighlightsPagination(){ .member(member) .threePointCount(random.nextInt(1,100)) .twoPointCount(random.nextInt(1,100)) - .isSelected(true) .highlightURL("test") .build(); highlight.setCreatedAt(LocalDateTime.now().minusDays(idx)); diff --git a/src/test/resources/sql/CreateHighlightDummyData.sql b/src/test/resources/sql/CreateHighlightDummyData.sql index f1c87662..28862df6 100644 --- a/src/test/resources/sql/CreateHighlightDummyData.sql +++ b/src/test/resources/sql/CreateHighlightDummyData.sql @@ -117,7 +117,6 @@ $$ member_id, two_point_count, three_point_count, - is_selected, created_at, modified_at) VALUES (gen_random_uuid(), @@ -126,7 +125,6 @@ $$ m.member_id, FLOOR(random() * 20)::INT, -- 0 ~ 19개 FLOOR(random() * 15)::INT, --0~14개 - CASE WHEN random() > 0.15 THEN TRUE ELSE FALSE END, created_at, created_at); END LOOP; diff --git a/src/test/resources/sql/VerificationHighlightData.sql b/src/test/resources/sql/VerificationHighlightData.sql index b60f45c8..ffddef46 100644 --- a/src/test/resources/sql/VerificationHighlightData.sql +++ b/src/test/resources/sql/VerificationHighlightData.sql @@ -13,7 +13,6 @@ WITH filtered AS ( member AS m ON h.member_id = m.member_id WHERE m.is_aggregation_agreed = TRUE - AND h.is_selected = TRUE AND h.created_at >= ? AND h.created_at < ? )