-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : User 관련 기능 API 작성 #83 * spotlessApply #83 * feat : User 차단 관련 검색, 조회 API 로직 변경 #83 * feat : User 신고 정보 조회 API 작성 #83 * spotless Apply #83 * edit : @transactional 추가 #83 * feat : 유저 검색 시 친구 여부 보여지도록 수정, 검색 로직 수정, 신고 api에서 request body 삭제 #83 * spotless Apply #83 * feat : 유저 검색 시 친구, 차단 여부 표시 #83 * edit : 유저 차단 시 로직 변경 #83 * edit : 친구 조회 시 페이지네이션 삭제, 쿼리 로직 변경 #83
- Loading branch information
1 parent
533dd69
commit 57bd177
Showing
9 changed files
with
95 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 14 additions & 7 deletions
21
Api/src/main/java/tify/server/api/user/service/RetrieveNeighborListUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
package tify.server.api.user.service; | ||
|
||
|
||
import java.util.List; | ||
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; | ||
import tify.server.api.common.slice.SliceResponse; | ||
import tify.server.api.utils.UserUtils; | ||
import tify.server.core.annotation.UseCase; | ||
import tify.server.domain.domains.user.adaptor.NeighborAdaptor; | ||
import tify.server.domain.domains.user.adaptor.UserAdaptor; | ||
import tify.server.domain.domains.user.adaptor.UserBlockAdaptor; | ||
import tify.server.domain.domains.user.domain.UserBlock; | ||
import tify.server.domain.domains.user.dto.condition.NeighborCondition; | ||
import tify.server.domain.domains.user.dto.model.RetrieveNeighborDTO; | ||
|
||
@Slf4j | ||
@UseCase | ||
@RequiredArgsConstructor | ||
public class RetrieveNeighborListUseCase { | ||
|
||
private final NeighborAdaptor neighborAdaptor; | ||
private final UserAdaptor userAdaptor; | ||
private final UserBlockAdaptor userBlockAdaptor; | ||
private final UserUtils userUtils; | ||
|
||
@Transactional(readOnly = true) | ||
public SliceResponse<RetrieveNeighborDTO> execute(Pageable pageable) { | ||
public List<RetrieveNeighborDTO> execute(Pageable pageable) { | ||
Long currentUserId = userUtils.getUserId(); | ||
NeighborCondition neighborCondition = new NeighborCondition(currentUserId, pageable); | ||
Slice<RetrieveNeighborDTO> neighborDTOS = | ||
neighborAdaptor.searchNeighbors(neighborCondition); | ||
return SliceResponse.of(neighborDTOS); | ||
List<Long> blockedUserList = | ||
userBlockAdaptor.queryAllByFromUserId(currentUserId).stream() | ||
.map(UserBlock::getToUserId) | ||
.toList(); | ||
NeighborCondition neighborCondition = | ||
new NeighborCondition(currentUserId, blockedUserList, pageable); | ||
return neighborAdaptor.searchNeighbors(neighborCondition); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...in/src/main/java/tify/server/domain/domains/user/repository/NeighborCustomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package tify.server.domain.domains.user.repository; | ||
|
||
|
||
import org.springframework.data.domain.Slice; | ||
import java.util.List; | ||
import tify.server.domain.domains.user.dto.condition.NeighborCondition; | ||
import tify.server.domain.domains.user.dto.model.RetrieveNeighborDTO; | ||
|
||
public interface NeighborCustomRepository { | ||
|
||
Slice<RetrieveNeighborDTO> searchToPage(NeighborCondition neighborCondition); | ||
List<RetrieveNeighborDTO> searchToPage(NeighborCondition neighborCondition); | ||
|
||
Slice<RetrieveNeighborDTO> searchBirthToPage(NeighborCondition neighborCondition); | ||
List<RetrieveNeighborDTO> searchBirthToPage(NeighborCondition neighborCondition); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters