Skip to content

Commit

Permalink
bug: 친구삭제 양방향목록삭제 버그해결
Browse files Browse the repository at this point in the history
  • Loading branch information
ez23re committed Nov 11, 2024
1 parent 9bcfabd commit 6a5a92d
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
95 changes: 95 additions & 0 deletions splanet-test.log
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,98 @@ eventType: API_REQUEST, userId: 2, deviceId: apiTestDeviceId, timestamp: 2024-11
eventType: LOGIN_SUCCESS, userId: 1, deviceId: testDeviceId, timestamp: 2024-11-12T01:09:31.692107, requestPath: /test/login, headers: User-Agent: TestAgent, Accept: */*
eventType: API_REQUEST, userId: 2, deviceId: apiTestDeviceId, timestamp: 2024-11-12T01:31:28.960904, requestPath: /test/api, headers: User-Agent: ApiTestAgent, Accept: application/json
eventType: LOGIN_SUCCESS, userId: 1, deviceId: testDeviceId, timestamp: 2024-11-12T01:31:28.972599, requestPath: /test/login, headers: User-Agent: TestAgent, Accept: */*
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.3028597, requestPath: /api/comments/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.5203791, requestPath: /api/comments/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.772894, requestPath: /api/comments, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.8690521, requestPath: /api/comments/1886, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.933985, requestPath: /api/comments/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:49.9962563, requestPath: /api/comments/409, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:50.0760239, requestPath: /api/comments/1892, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:50.250223, requestPath: /api/comments/412, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:50.3120036, requestPath: /api/comments, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:50.3747438, requestPath: /api/comments/414, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.1246169, requestPath: /api/friends/999/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.28604, requestPath: /api/friends/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.4156765, requestPath: /api/friends/1/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.6244195, requestPath: /api/friends/1904, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.8433793, requestPath: /api/friends, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:52.9487333, requestPath: /api/friends/1, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:53.0457083, requestPath: /api/friends, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:53.9521541, requestPath: /api/friends/requests, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.0340107, requestPath: /api/friends/requests/999/cancel, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.218513, requestPath: /api/friends/requests/158/accept, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.3053053, requestPath: /api/friends/requests, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.4208858, requestPath: /api/friends/requests/159/cancel, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.4540264, requestPath: /api/friends/requests/sent, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.5844674, requestPath: /api/friends/requests/160/cancel, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.6998971, requestPath: /api/friends/requests/161/reject, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.8226564, requestPath: /api/friends/requests, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:54.9297461, requestPath: /api/friends/requests/received, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:50:55.0453017, requestPath: /api/friends/requests/sent, headers:
eventType: API_REQUEST, userId: 2, deviceId: apiTestDeviceId, timestamp: 2024-11-12T01:51:11.4133233, requestPath: /test/api, headers: User-Agent: ApiTestAgent, Accept: application/json
eventType: LOGIN_SUCCESS, userId: 1, deviceId: testDeviceId, timestamp: 2024-11-12T01:51:11.4389194, requestPath: /test/login, headers: User-Agent: TestAgent, Accept: */*
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.1399193, requestPath: /api/payment/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.2281242, requestPath: /api/payment/57, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.3120922, requestPath: /api/payment/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.381132, requestPath: /api/payment/59, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.847827, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.9241445, requestPath: /api/plans/3, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:12.9484284, requestPath: /api/plans/3, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.008211, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.0400897, requestPath: /api/plans/4, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.0967577, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.1300244, requestPath: /api/plans/5, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.1877451, requestPath: /api/plans/9999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.2559353, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.3151272, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.4043286, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.4805706, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.5505545, requestPath: /api/plans/8, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.6053511, requestPath: /api/plans/9999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.6707081, requestPath: /api/plans/9, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.7459455, requestPath: /api/plans/10, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.8041065, requestPath: /api/plans/9999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.8724285, requestPath: /api/plans/9999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:13.9503133, requestPath: /api/plans/11, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:14.0083136, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:14.0726492, requestPath: /api/plans/12, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:14.1280526, requestPath: /api/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:14.9823068, requestPath: /api/subscription/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:15.0881529, requestPath: /api/subscription/me/subscribe, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:15.1681591, requestPath: /api/subscription/me/subscribe, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:15.2711891, requestPath: /api/subscriptions/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:15.4890487, requestPath: /api/teams/168/invite, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:15.6581786, requestPath: /api/teams/169/invite, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.3431456, requestPath: /api/teams/170/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.4168068, requestPath: /api/teams/170/plans/56, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.4852017, requestPath: /api/teams/171/plans/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.5630507, requestPath: /api/teams/172/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.6365126, requestPath: /api/teams/173/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.7654453, requestPath: /api/teams/174/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.8461776, requestPath: /api/teams/175/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.8868654, requestPath: /api/teams/175/plans/58, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.9186508, requestPath: /api/teams/175/plans/58, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:16.984638, requestPath: /api/teams/176/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.0113651, requestPath: /api/teams/176/plans/59, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.0769448, requestPath: /api/teams/177/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.1066412, requestPath: /api/teams/177/plans/60, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.1805787, requestPath: /api/teams/178/plans/999, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.2588973, requestPath: /api/teams/179/plans, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:17.2859849, requestPath: /api/teams/179/plans/61, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.0306386, requestPath: /api/users/create, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.0792517, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.1027003, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.1498642, requestPath: /api/users/create, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.1789634, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.1974601, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.2124668, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.2585632, requestPath: /api/users/create, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.2998102, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.3729508, requestPath: /api/users/create, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.5490552, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.6035407, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.6598154, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.7129503, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.7684137, requestPath: /api/users/me, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.8315305, requestPath: /api/users/create, headers:
eventType: API_REQUEST, userId: null, deviceId: null, timestamp: 2024-11-12T01:51:18.9064907, requestPath: /api/users/me, headers:
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,23 @@ public ResponseEntity<List<PlanResponseDto>> getFriendPlan(Long friendId, Long u
return ResponseEntity.ok(planResponseDtos);
}

// 친구 삭제(취소)하기

// 친구 삭제(취소)하기
@Transactional
public ResponseEntity<Map<String, String>> unfriend(Long friendId, Long userId) {
// 내 친구 목록에 존재하는지
if (!friendRepository.existsByUserIdAndFriendId(userId, friendId)) {
throw new BusinessException(ErrorCode.FRIEND_NOT_FOUND);
}

// 내가 내 친구 목록에서 친구 삭제
friendRepository.deleteByRequesterIdAndReceiverId(userId, friendId);

// 친구의 친구 목록에서도 나를 삭제
friendRepository.deleteByRequesterIdAndReceiverId(friendId, userId);

// 그 친구 관련 친구 요청도 있으면, 삭제
List<FriendRequest> pendingRequests = friendRequestRepository.findPendingRequestsByReceiverId(userId, friendId, FriendRequest.Status.PENDING);
for (FriendRequest request : pendingRequests) {
friendRequestRepository.delete(request);
Expand Down

0 comments on commit 6a5a92d

Please sign in to comment.