Skip to content

Commit

Permalink
[feat] 검색 로직 수정 (#109)
Browse files Browse the repository at this point in the history
* [fix] 검색 로직 수정 #108

* [chore] spotless 적용 #108

* [feat] archiving response 변경 #108
  • Loading branch information
wjdtkdgns authored Aug 17, 2023
1 parent 1c2783f commit 7797de4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import allchive.server.domain.domains.archiving.domain.enums.Category;
import allchive.server.domain.domains.user.domain.User;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;

Expand All @@ -23,6 +24,9 @@ public class ArchivingContentsResponse {
@Schema(description = "아카이빙 고유번호")
private Long archivingId;

@Schema(description = "아카이빙 생성일")
private LocalDateTime createdAt;

@Schema(description = "아카이빙의 총 컨텐츠 개수")
private Long totalContentsCount;

Expand All @@ -47,6 +51,7 @@ private ArchivingContentsResponse(
String archivingTitle,
Category category,
Long archivingId,
LocalDateTime createdAt,
Long totalContentsCount,
Long ownerId,
String ownerNickname,
Expand All @@ -57,6 +62,7 @@ private ArchivingContentsResponse(
this.archivingTitle = archivingTitle;
this.category = category;
this.archivingId = archivingId;
this.createdAt = createdAt;
this.totalContentsCount = totalContentsCount;
this.ownerId = ownerId;
this.ownerNickname = ownerNickname;
Expand All @@ -73,9 +79,10 @@ public static ArchivingContentsResponse of(
Boolean isScrap) {
return ArchivingContentsResponse.builder()
.archivingId(archiving.getId())
.createdAt(archiving.getCreatedAt())
.archivingTitle(archiving.getTitle())
.category(archiving.getCategory())
.totalContentsCount(archiving.getScrapCnt() + archiving.getImgCnt())
.totalContentsCount(archiving.getLinkCnt() + archiving.getImgCnt())
.contents(contentResponseSlice)
.ownerId(user.getId())
.ownerNickname(user.getNickname())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Page<Archiving> querySliceArchivingByKeywordExceptBlockOrderByTagArchving
.from(archiving)
.where(
userIdNotIn(blockList),
userIdEqOrPublicStatusTrue(userId),
userIdNeAndPublicStatusTrue(userId),
deleteStatusFalse(),
titleContainOrIdIn(keyword, tagArchivingIds))
.orderBy(
Expand Down Expand Up @@ -191,6 +191,10 @@ private BooleanExpression userIdEqOrPublicStatusTrue(Long userId) {
return archiving.userId.eq(userId).or(archiving.publicStatus.eq(Boolean.TRUE));
}

private BooleanExpression userIdNeAndPublicStatusTrue(Long userId) {
return archiving.userId.ne(userId).and(archiving.publicStatus.eq(Boolean.TRUE));
}

private OrderSpecifier<Long> scrabListDesc(List<Long> archivingIdList) {
NumberExpression<Long> pinStatus =
new CaseBuilder().when(archiving.id.in(archivingIdList)).then(1L).otherwise(0L);
Expand Down

0 comments on commit 7797de4

Please sign in to comment.