-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 어드민 유저 관리 기능 추가 #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JAEHEE25
merged 5 commits into
solid-connection:develop
from
JAEHEE25:feature/534-admin-user-management_v2
Mar 5, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
src/main/java/com/example/solidconnection/admin/controller/AdminUserController.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package com.example.solidconnection.admin.controller; | ||
|
|
||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.ModelAttribute; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchResponse; | ||
| import com.example.solidconnection.admin.dto.UserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.UserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.UserSearchResponse; | ||
| import com.example.solidconnection.admin.service.AdminUserService; | ||
| import com.example.solidconnection.common.response.PageResponse; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @RequiredArgsConstructor | ||
| @RequestMapping("/admin/users") | ||
| @RestController | ||
| public class AdminUserController { | ||
|
|
||
| private final AdminUserService adminUserService; | ||
|
|
||
| @GetMapping | ||
| public ResponseEntity<PageResponse<UserSearchResponse>> searchAllUsers( | ||
| @Valid @ModelAttribute UserSearchCondition searchCondition, | ||
| Pageable pageable | ||
| ) { | ||
| Page<UserSearchResponse> page = adminUserService.searchAllUsers(searchCondition, pageable); | ||
| return ResponseEntity.ok(PageResponse.of(page)); | ||
| } | ||
|
|
||
| @GetMapping("/{user-id}") | ||
| public ResponseEntity<UserInfoDetailResponse> getUserInfoDetail( | ||
| @PathVariable(name = "user-id") long userId | ||
| ) { | ||
| UserInfoDetailResponse response = adminUserService.getUserInfoDetail(userId); | ||
| return ResponseEntity.ok(response); | ||
| } | ||
|
|
||
| @GetMapping("/restricted") | ||
| public ResponseEntity<PageResponse<RestrictedUserSearchResponse>> searchRestrictedUsers( | ||
| @Valid @ModelAttribute RestrictedUserSearchCondition searchCondition, | ||
| Pageable pageable | ||
| ) { | ||
| Page<RestrictedUserSearchResponse> page = adminUserService.searchRestrictedUsers(searchCondition, pageable); | ||
| return ResponseEntity.ok(PageResponse.of(page)); | ||
| } | ||
|
|
||
| @GetMapping("/restricted/{user-id}") | ||
| public ResponseEntity<RestrictedUserInfoDetailResponse> getRestrictedUserInfoDetail( | ||
| @PathVariable(name = "user-id") long userId | ||
| ) { | ||
| RestrictedUserInfoDetailResponse response = adminUserService.getRestrictedUserInfoDetail(userId); | ||
| return ResponseEntity.ok(response); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/example/solidconnection/admin/dto/BannedHistoryResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.time.ZonedDateTime; | ||
|
|
||
| public record BannedHistoryResponse( | ||
| ZonedDateTime createdAt | ||
| ) { | ||
|
|
||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/example/solidconnection/admin/dto/BannedInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.UserBanDuration; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record BannedInfoResponse( | ||
| @JsonProperty("isBanned") boolean isBanned, | ||
| UserBanDuration duration | ||
| ) { | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/solidconnection/admin/dto/MatchedInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.time.ZonedDateTime; | ||
|
|
||
| public record MatchedInfoResponse( | ||
| String nickname, | ||
| ZonedDateTime matchedDate | ||
| ) { | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/solidconnection/admin/dto/MenteeInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record MenteeInfoResponse( | ||
| UnivApplyInfoResponse univApplyInfo, | ||
| List<MatchedInfoResponse> mentorInfos | ||
| ) { | ||
|
|
||
| } |
12 changes: 12 additions & 0 deletions
12
...main/java/com/example/solidconnection/admin/dto/MentorApplicationHistoryInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.mentor.domain.MentorApplicationStatus; | ||
| import java.time.ZonedDateTime; | ||
|
|
||
| public record MentorApplicationHistoryInfoResponse( | ||
| MentorApplicationStatus mentorApplicationStatus, | ||
| String rejectedReason, | ||
| ZonedDateTime createdAt | ||
| ) { | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/solidconnection/admin/dto/MentorInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record MentorInfoResponse( | ||
| List<MatchedInfoResponse> menteeInfos, | ||
| List<MentorApplicationHistoryInfoResponse> mentorApplicationHistory | ||
| ) { | ||
|
|
||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/example/solidconnection/admin/dto/ReportedHistoryResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.time.ZonedDateTime; | ||
|
|
||
| import com.example.solidconnection.report.domain.ReportType; | ||
|
|
||
| public record ReportedHistoryResponse( | ||
| ZonedDateTime reportedDate, | ||
| ReportType reportType | ||
| ) { | ||
|
|
||
| } |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/example/solidconnection/admin/dto/ReportedInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.time.ZonedDateTime; | ||
|
|
||
| import com.example.solidconnection.report.domain.ReportType; | ||
| import com.example.solidconnection.report.domain.TargetType; | ||
|
|
||
| public record ReportedInfoResponse( | ||
| ZonedDateTime reportedDate, | ||
| TargetType targetType, | ||
| ReportType reportType | ||
| ) { | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/solidconnection/admin/dto/RestrictedUserInfoDetailResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record RestrictedUserInfoDetailResponse( | ||
| List<ReportedHistoryResponse> reportedHistoryResponses, | ||
| List<BannedHistoryResponse> bannedHistoryResponses | ||
| ) { | ||
|
|
||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/example/solidconnection/admin/dto/RestrictedUserSearchCondition.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.Role; | ||
| import com.example.solidconnection.siteuser.domain.UserStatus; | ||
|
|
||
| public record RestrictedUserSearchCondition( | ||
| Role role, | ||
| UserStatus userStatus, | ||
| String keyword | ||
| ) { | ||
|
|
||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/example/solidconnection/admin/dto/RestrictedUserSearchResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.Role; | ||
| import com.example.solidconnection.siteuser.domain.UserStatus; | ||
|
|
||
| public record RestrictedUserSearchResponse( | ||
| Long id, | ||
| String nickname, | ||
| Role role, | ||
| UserStatus userStatus, | ||
| ReportedInfoResponse reportedInfoResponse, | ||
| BannedInfoResponse bannedInfoResponse | ||
| ) { | ||
|
|
||
| } |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/example/solidconnection/admin/dto/UnivApplyInfoResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| public record UnivApplyInfoResponse( | ||
| String firstChoiceUnivName, | ||
| String secondChoiceUnivName, | ||
| String thirdChoiceUnivName | ||
| ) { | ||
|
|
||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/example/solidconnection/admin/dto/UserInfoDetailResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record UserInfoDetailResponse( | ||
| MentorInfoResponse mentorInfoResponse, // 멘티일 경우 null | ||
| MenteeInfoResponse menteeInfoResponse, // 멘토일 경우 null | ||
| List<ReportedHistoryResponse> reportedHistoryResponses | ||
| ) { | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/solidconnection/admin/dto/UserSearchCondition.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.Role; | ||
|
|
||
| public record UserSearchCondition( | ||
| Role role, | ||
| String keyword | ||
| ) { | ||
|
|
||
| } |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/example/solidconnection/admin/dto/UserSearchResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.Role; | ||
| import com.example.solidconnection.siteuser.domain.UserStatus; | ||
|
|
||
| public record UserSearchResponse( | ||
| Long id, | ||
| String nickname, | ||
| String email, | ||
| Role role, | ||
| UserStatus userStatus | ||
| ) { | ||
|
|
||
| } |
50 changes: 50 additions & 0 deletions
50
src/main/java/com/example/solidconnection/admin/service/AdminUserService.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package com.example.solidconnection.admin.service; | ||
|
|
||
| import static com.example.solidconnection.common.exception.ErrorCode.USER_NOT_FOUND; | ||
|
|
||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchResponse; | ||
| import com.example.solidconnection.admin.dto.UserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.UserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.UserSearchResponse; | ||
| import com.example.solidconnection.common.exception.CustomException; | ||
| import com.example.solidconnection.siteuser.domain.SiteUser; | ||
| import com.example.solidconnection.siteuser.repository.SiteUserRepository; | ||
| import com.example.solidconnection.siteuser.repository.custom.SiteUserFilterRepository; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @RequiredArgsConstructor | ||
| @Service | ||
| public class AdminUserService { | ||
|
|
||
| private final SiteUserRepository siteUserRepository; | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public Page<UserSearchResponse> searchAllUsers(UserSearchCondition searchCondition, Pageable pageable) { | ||
| return siteUserRepository.searchAllUsers(searchCondition, pageable); | ||
| } | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public Page<RestrictedUserSearchResponse> searchRestrictedUsers(RestrictedUserSearchCondition searchCondition, Pageable pageable) { | ||
| return siteUserRepository.searchRestrictedUsers(searchCondition, pageable); | ||
| } | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public UserInfoDetailResponse getUserInfoDetail(long userId) { | ||
| SiteUser siteUser = siteUserRepository.findById(userId) | ||
| .orElseThrow(() -> new CustomException(USER_NOT_FOUND)); | ||
| return siteUserRepository.getUserInfoDetailByUserId(siteUser); | ||
| } | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public RestrictedUserInfoDetailResponse getRestrictedUserInfoDetail(long userId) { | ||
| SiteUser siteUser = siteUserRepository.findById(userId) | ||
| .orElseThrow(() -> new CustomException(USER_NOT_FOUND)); | ||
| return siteUserRepository.getRestrictedUserInfoDetail(siteUser.getId()); | ||
| } | ||
| } | ||
This file contains hidden or 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
22 changes: 22 additions & 0 deletions
22
...java/com/example/solidconnection/siteuser/repository/custom/SiteUserFilterRepository.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.example.solidconnection.siteuser.repository.custom; | ||
|
|
||
| import com.example.solidconnection.siteuser.domain.SiteUser; | ||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.RestrictedUserSearchResponse; | ||
| import com.example.solidconnection.admin.dto.UserInfoDetailResponse; | ||
| import com.example.solidconnection.admin.dto.UserSearchCondition; | ||
| import com.example.solidconnection.admin.dto.UserSearchResponse; | ||
|
|
||
| public interface SiteUserFilterRepository { | ||
|
|
||
| Page<UserSearchResponse> searchAllUsers(UserSearchCondition searchCondition, Pageable pageable); | ||
|
|
||
| Page<RestrictedUserSearchResponse> searchRestrictedUsers(RestrictedUserSearchCondition searchCondition, Pageable pageable); | ||
|
|
||
| UserInfoDetailResponse getUserInfoDetailByUserId(SiteUser user); | ||
|
|
||
| RestrictedUserInfoDetailResponse getRestrictedUserInfoDetail(long userId); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.