Skip to content

Commit

Permalink
[chore] spotless 적용 #63
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdtkdgns committed Jul 26, 2023
1 parent 5c64167 commit f4b08a1
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import allchive.server.api.search.model.dto.request.DeleteLatestSearchRequest;
import allchive.server.api.search.model.dto.request.SearchRequest;
import allchive.server.api.search.model.dto.response.SearchListResponse;
import allchive.server.api.search.model.dto.response.SearchResponse;
import allchive.server.api.search.model.dto.response.SearchVoListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package allchive.server.api.search.model.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Getter;

@Getter
public class DeleteLatestSearchRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
import allchive.server.api.config.security.SecurityUtil;
import allchive.server.api.search.model.dto.request.DeleteLatestSearchRequest;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.domains.search.adaptor.LatestSearchAdaptor;
import allchive.server.domain.domains.search.service.LatestSearchDomainService;
import allchive.server.domain.domains.search.validator.LatestSearchValidator;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@UseCase
@RequiredArgsConstructor
public class DeleteLatestSearchUseCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static allchive.server.core.consts.AllchiveConst.SEARCH_KEY;
import static jodd.util.StringPool.ASTERISK;

import allchive.server.api.search.model.dto.request.SearchRequest;
import allchive.server.api.search.model.dto.response.SearchListResponse;
import allchive.server.core.annotation.UseCase;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.transaction.annotation.Transactional;

@UseCase
@Slf4j
@RequiredArgsConstructor
public class SearchArchivingUseCase {
private final ArchivingAdaptor archivingAdaptor;
Expand Down Expand Up @@ -67,7 +64,6 @@ public SearchResponse execute(Pageable pageable, ArchivingType type, String word

private Set<Long> getTagArchivingIds(Long userId, String word) {
List<Tag> tags = tagAdaptor.findAllByUserIdAndName(userId, word);
tags.forEach(tag -> log.info(tag.getName()));
return contentTagGroupAdaptor.queryContentTagGroupByTagInWithContent(tags).stream()
.map(contentTagGroup -> contentTagGroup.getContent().getArchivingId())
.collect(Collectors.toSet());
Expand All @@ -85,14 +81,18 @@ private void renewalLatestSearch(Long userId, String keyword) {
}

private boolean isExistSearchKeyword(List<LatestSearch> searches, String keyword) {
return !searches.stream().filter(search -> search.getKeyword().equals(keyword)).toList().isEmpty();
return !searches.stream()
.filter(search -> search.getKeyword().equals(keyword))
.toList()
.isEmpty();
}

private SliceResponse<ArchivingResponse> getMyArchivings(
Long userId, String keyword, Pageable pageable, Set<Long> tagArchivingIds) {
Slice<ArchivingResponse> archivingSlices =
archivingAdaptor
.querySliceArchivingByUserIdAndKeywordsOrderByTagArchvingIds(userId, keyword, pageable, tagArchivingIds)
.querySliceArchivingByUserIdAndKeywordsOrderByTagArchvingIds(
userId, keyword, pageable, tagArchivingIds)
.map(archiving -> ArchivingResponse.of(archiving, Boolean.FALSE));
return SliceResponse.of(archivingSlices);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import allchive.server.domain.domains.archiving.repository.ArchivingRepository;
import java.util.List;
import java.util.Set;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
Expand Down Expand Up @@ -82,7 +81,11 @@ public Slice<Archiving> querySliceArchivingByUserIdAndKeywordsOrderByTagArchving
}

public Slice<Archiving> querySliceArchivingByKeywordExceptBlockOrderByTagArchvingIds(
List<Long> archivingIdList, List<Long> blockList, String keyword, Pageable pageable, Set<Long> tagArchivingIds) {
List<Long> archivingIdList,
List<Long> blockList,
String keyword,
Pageable pageable,
Set<Long> tagArchivingIds) {
return archivingRepository.querySliceArchivingByKeywordExceptBlockOrderByTagArchvingIds(
archivingIdList, blockList, keyword, pageable, tagArchivingIds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import allchive.server.domain.domains.archiving.domain.enums.Category;
import java.util.List;
import java.util.Set;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;

Expand All @@ -26,5 +25,9 @@ Slice<Archiving> querySliceArchivingByUserIdAndKeywordsOrderByTagArchvingIds(
Long userId, String keyword, Pageable pageable, Set<Long> tagArchivingIds);

Slice<Archiving> querySliceArchivingByKeywordExceptBlockOrderByTagArchvingIds(
List<Long> archivingIdList, List<Long> blockList, String keyword, Pageable pageable, Set<Long> tagArchivingIds);
List<Long> archivingIdList,
List<Long> blockList,
String keyword,
Pageable pageable,
Set<Long> tagArchivingIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
Expand Down Expand Up @@ -110,7 +109,11 @@ public Slice<Archiving> querySliceArchivingByUserIdAndKeywordsOrderByTagArchving

@Override
public Slice<Archiving> querySliceArchivingByKeywordExceptBlockOrderByTagArchvingIds(
List<Long> archivingIdList, List<Long> blockList, String keyword, Pageable pageable, Set<Long> tagArchivingIds) {
List<Long> archivingIdList,
List<Long> blockList,
String keyword,
Pageable pageable,
Set<Long> tagArchivingIds) {
List<Archiving> archivings =
queryFactory
.select(archiving)
Expand All @@ -120,7 +123,11 @@ public Slice<Archiving> querySliceArchivingByKeywordExceptBlockOrderByTagArchvin
publicStatusTrue(),
deleteStatusFalse(),
titleContainOrIdIn(keyword, tagArchivingIds))
.orderBy(idIn(tagArchivingIds), scrabListDesc(archivingIdList), scrapCntDesc(), createdAtDesc())
.orderBy(
idIn(tagArchivingIds),
scrabListDesc(archivingIdList),
scrapCntDesc(),
createdAtDesc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize() + 1)
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import allchive.server.domain.domains.content.domain.Content;
import allchive.server.domain.domains.content.domain.ContentTagGroup;
import allchive.server.domain.domains.content.domain.Tag;

import java.util.List;

public interface ContentTagGroupCustomRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package allchive.server.domain.domains.content.repository;

import static allchive.server.domain.domains.content.domain.QContent.content;
import static allchive.server.domain.domains.content.domain.QContentTagGroup.contentTagGroup;
import static allchive.server.domain.domains.content.domain.QTag.tag;
import static allchive.server.domain.domains.content.domain.QContent.content;

import allchive.server.domain.domains.content.domain.Content;
import allchive.server.domain.domains.content.domain.ContentTagGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import allchive.server.core.annotation.Adaptor;
import allchive.server.domain.domains.search.domain.LatestSearch;
import allchive.server.domain.domains.search.exception.exceptions.LatestSearchNotFoundException;
import allchive.server.domain.domains.search.repository.LatestSearchRepository;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import allchive.server.domain.domains.search.domain.LatestSearch;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;

public interface LatestSearchRepository extends JpaRepository<LatestSearch, Long> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import allchive.server.core.annotation.DomainService;
import allchive.server.domain.domains.search.adaptor.LatestSearchAdaptor;
import allchive.server.domain.domains.search.domain.LatestSearch;
import lombok.RequiredArgsConstructor;

import java.util.List;
import lombok.RequiredArgsConstructor;

@DomainService
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import allchive.server.domain.domains.search.domain.LatestSearch;
import allchive.server.domain.domains.search.exception.exceptions.LatestSearchNotFoundException;
import allchive.server.domain.domains.search.exception.exceptions.NoAuthorityUpdateLatestSearchException;
import lombok.RequiredArgsConstructor;

import java.util.List;
import lombok.RequiredArgsConstructor;

@Validator
@RequiredArgsConstructor
Expand All @@ -24,10 +23,11 @@ public void validateExistByIdIn(List<Long> ids) {

public void verifyUserByIdIn(List<Long> ids, Long userId) {
List<LatestSearch> searches = latestSearchAdaptor.findAllByIdIn(ids);
searches.forEach(search -> {
if (!search.getUserId().equals(userId)) {
throw NoAuthorityUpdateLatestSearchException.EXCEPTION;
}
});
searches.forEach(
search -> {
if (!search.getUserId().equals(userId)) {
throw NoAuthorityUpdateLatestSearchException.EXCEPTION;
}
});
}
}

0 comments on commit f4b08a1

Please sign in to comment.