Skip to content

Commit

Permalink
[FEATURE] 유저 정보 조회, 친구 신청 거절 로직 수정 (#93)
Browse files Browse the repository at this point in the history
* 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

* edit : 친구 정보 조회 시 양방향 로직 추가 #83
  • Loading branch information
bongsh0112 authored Nov 9, 2023
1 parent 57bd177 commit e84c81e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import tify.server.api.config.security.SecurityUtils;
import tify.server.core.annotation.UseCase;
import tify.server.domain.domains.user.adaptor.NeighborAdaptor;
import tify.server.domain.domains.user.domain.Neighbor;
import tify.server.domain.domains.user.domain.NeighborApplication;
import tify.server.domain.domains.user.exception.NeighborNotFoundException;
import tify.server.domain.domains.user.validator.NeighborValidator;

@UseCase
Expand All @@ -25,5 +27,11 @@ public void execute(Long neighborApplicationId) {
neighborValidator.userIdAndNeighborApplicationValidate(neighborApplication, currentUserId);

neighborApplication.reject();

Neighbor neighbor =
neighborAdaptor
.queryByFromUserIdAndToUserId(neighborApplicationId, currentUserId)
.orElseThrow(() -> NeighborNotFoundException.EXCEPTION);
neighborAdaptor.delete(neighbor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public class UserInfoUseCase {

public UserProfileVo execute(Long searchedUserId) {
Long currentUserId = SecurityUtils.getCurrentUserId();
Optional<Neighbor> neighbor =
Optional<Neighbor> fromNeighbor =
neighborAdaptor.queryByFromUserIdAndToUserId(currentUserId, searchedUserId);
Optional<Neighbor> toNeighbor =
neighborAdaptor.queryByFromUserIdAndToUserId(searchedUserId, currentUserId);
Optional<UserBlock> userBlock =
userBlockAdaptor.queryByFromUserIdAndToUserId(currentUserId, searchedUserId);
Optional<NeighborApplication> receivedApplication =
Expand All @@ -36,7 +38,7 @@ public UserProfileVo execute(Long searchedUserId) {
neighborAdaptor.optionalQueryByFromUserIdAndToUserId(currentUserId, searchedUserId);
return UserProfileVo.of(
userAdaptor.query(searchedUserId),
neighbor.isPresent(),
fromNeighbor.isPresent() && toNeighbor.isPresent(),
userBlock.isPresent(),
receivedApplication.orElse(null),
sentApplication.orElse(null));
Expand Down

0 comments on commit e84c81e

Please sign in to comment.