Skip to content

Commit 10d97cc

Browse files
authored
Merge pull request #191 from SMU-SATTO/feature/#190
[Chore] 계정 공개시 팔로우 요청 수락 목록 문제
2 parents 2788b65 + 81b951b commit 10d97cc

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/main/java/com/example/satto/domain/follow/service/FollowService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public interface FollowService {
1717
BaseResponse<Object> unFollowing(String followingId, String studentId);
1818

1919
Map<String, String> followRequestList(String studentId);
20+
21+
BaseResponse<String> findFollowRequestToChangePublic(String studentId);
2022
}

src/main/java/com/example/satto/domain/follow/service/Impl/FollowServiceImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ public Map<String, String> followRequestList(String studentId) {
5050
return followRequesters;
5151
}
5252

53+
@Override
54+
public BaseResponse<String> findFollowRequestToChangePublic(String studentId) {
55+
List<Follow> followerRequests = followRepository.findByFollowingIdStudentIdAndRequest(studentId, 1);
56+
if (followerRequests.isEmpty()) {
57+
return BaseResponse.onSuccess("Follow 요청 목록이 비어있습니다.");
58+
}
59+
else {
60+
for (Follow user: followerRequests) {
61+
user.setRequest(2);
62+
followRepository.save(user);
63+
}
64+
return BaseResponse.onSuccess("Follow 요청 모록 유저들을 수락했습니다.");
65+
}
66+
}
67+
5368
@Transactional
5469
@Override
5570
public BaseResponse<Object> acceptFollower(String followerId, String studentId) {

src/main/java/com/example/satto/domain/users/controller/UsersController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.satto.domain.users.controller;
22

3+
import com.example.satto.domain.follow.service.FollowService;
34
import com.example.satto.domain.users.converter.UsersConverter;
45
import com.example.satto.domain.users.dto.UsersRequestDTO;
56
import com.example.satto.domain.users.dto.UsersResponseDTO;
@@ -22,6 +23,7 @@
2223
public class UsersController {
2324

2425
private final UsersService usersService;
26+
private final FollowService followService;
2527
// private final FileService fileService;
2628

2729
// email 중복 확인
@@ -120,6 +122,8 @@ public BaseResponse<?> privateAccount(@AuthenticationPrincipal Users user) {
120122
@PatchMapping("account/public")
121123
public BaseResponse<?> publicAccount(@AuthenticationPrincipal Users user) {
122124
Long userId = user.getUserId();
125+
String studentId = user.getStudentId();
126+
followService.findFollowRequestToChangePublic(studentId);
123127
usersService.publicAccount(userId);
124128
return BaseResponse.onSuccess("공개 설정 완료");
125129
}

0 commit comments

Comments
 (0)