Skip to content

Commit f61da95

Browse files
author
Lee Euije
authored
YEL-163 [deploy] v1.198
YEL-163 [deploy] v1.198
2 parents f0d6991 + 2375fb9 commit f61da95

File tree

73 files changed

+9995
-2570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+9995
-2570
lines changed

src/docs/asciidoc/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
* link:find-onboarding-friends.html[가입한 친구 목록 불러오기]
1919

20-
* link:search-school.html[대학교 검색하기]
20+
* link:search-userGroup.html[대학교 검색하기]
2121

2222
* link:search-department.html[대학교 학과 검색하기]
2323

src/main/java/com/yello/server/domain/admin/dto/response/AdminUserContentVO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static com.yello.server.global.common.factory.TimeFactory.toDateFormattedString;
44

5-
import com.yello.server.domain.group.entity.School;
5+
import com.yello.server.domain.group.entity.UserGroup;
66
import com.yello.server.domain.user.entity.User;
77
import lombok.Builder;
88

@@ -18,7 +18,7 @@ public record AdminUserContentVO(
1818
) {
1919

2020
public static AdminUserContentVO of(User user) {
21-
final School userGroup = user.getGroup();
21+
final UserGroup userGroup = user.getGroup();
2222

2323
return AdminUserContentVO.builder()
2424
.id(user.getId())

src/main/java/com/yello/server/domain/authorization/controller/AuthController.java

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
package com.yello.server.domain.authorization.controller;
22

3+
import static com.yello.server.global.common.SuccessCode.CLASS_NAME_SEARCH_BY_SCHOOL_NAME_SCHOOL_SUCCESS;
34
import static com.yello.server.global.common.SuccessCode.DEPARTMENT_NAME_SEARCH_BY_SCHOOL_NAME_SCHOOL_SUCCESS;
45
import static com.yello.server.global.common.SuccessCode.LOGIN_SUCCESS;
56
import static com.yello.server.global.common.SuccessCode.ONBOARDING_FRIENDS_SUCCESS;
67
import static com.yello.server.global.common.SuccessCode.RE_ISSUE_TOKEN_AUTH_SUCCESS;
7-
import static com.yello.server.global.common.SuccessCode.SCHOOL_NAME_SEARCH_SCHOOL_SUCCESS;
88
import static com.yello.server.global.common.SuccessCode.SIGN_UP_SUCCESS;
9+
import static com.yello.server.global.common.SuccessCode.UNIVERSITY_NAME_SEARCH_USER_GROUP_SUCCESS;
910
import static com.yello.server.global.common.SuccessCode.YELLOID_VALIDATION_SUCCESS;
1011
import static com.yello.server.global.common.factory.PaginationFactory.createPageable;
1112

1213
import com.yello.server.domain.authorization.dto.ServiceTokenVO;
1314
import com.yello.server.domain.authorization.dto.request.OAuthRequest;
1415
import com.yello.server.domain.authorization.dto.request.OnBoardingFriendRequest;
1516
import com.yello.server.domain.authorization.dto.request.SignUpRequest;
17+
import com.yello.server.domain.authorization.dto.response.ClassNameSearchResponse;
1618
import com.yello.server.domain.authorization.dto.response.DepartmentSearchResponse;
1719
import com.yello.server.domain.authorization.dto.response.GroupNameSearchResponse;
1820
import com.yello.server.domain.authorization.dto.response.OAuthResponse;
1921
import com.yello.server.domain.authorization.dto.response.OnBoardingFriendResponse;
2022
import com.yello.server.domain.authorization.dto.response.SignUpResponse;
2123
import com.yello.server.domain.authorization.service.AuthService;
24+
import com.yello.server.domain.group.entity.UserGroupType;
2225
import com.yello.server.global.common.annotation.ServiceToken;
2326
import com.yello.server.global.common.dto.BaseResponse;
2427
import com.yello.server.infrastructure.slack.annotation.SlackSignUpNotification;
@@ -54,7 +57,8 @@ public BaseResponse<Boolean> getYelloIdValidation(@RequestParam("yelloId") Strin
5457

5558
@PostMapping("/signup")
5659
@SlackSignUpNotification
57-
public BaseResponse<SignUpResponse> postSignUp(@Valid @RequestBody SignUpRequest signUpRequest) {
60+
public BaseResponse<SignUpResponse> postSignUp(
61+
@Valid @RequestBody SignUpRequest signUpRequest) {
5862
val data = authService.signUp(signUpRequest);
5963
return BaseResponse.success(SIGN_UP_SUCCESS, data);
6064
}
@@ -68,22 +72,23 @@ public BaseResponse<OnBoardingFriendResponse> postFriendList(
6872
return BaseResponse.success(ONBOARDING_FRIENDS_SUCCESS, data);
6973
}
7074

71-
@GetMapping("/school")
72-
public BaseResponse<GroupNameSearchResponse> getSchoolList(
75+
@GetMapping("/group/univ/name")
76+
public BaseResponse<GroupNameSearchResponse> getUniversityList(
7377
@NotNull @RequestParam("keyword") String keyword,
7478
@NotNull @RequestParam("page") Integer page
7579
) {
76-
val data = authService.findSchoolsByKeyword(keyword, createPageable(page));
77-
return BaseResponse.success(SCHOOL_NAME_SEARCH_SCHOOL_SUCCESS, data);
80+
val data = authService.findGroupNameContaining(keyword, UserGroupType.UNIVERSITY, createPageable(page));
81+
return BaseResponse.success(UNIVERSITY_NAME_SEARCH_USER_GROUP_SUCCESS, data);
7882
}
7983

80-
@GetMapping("/school/department")
84+
@GetMapping("/group/univ/department")
8185
public BaseResponse<DepartmentSearchResponse> getDepartmentList(
82-
@NotNull @RequestParam("school") String schoolName,
86+
@NotNull @RequestParam("name") String schoolName,
8387
@NotNull @RequestParam("keyword") String keyword,
8488
@NotNull @RequestParam("page") Integer page
8589
) {
86-
val data = authService.findDepartmentsByKeyword(schoolName, keyword, createPageable(page));
90+
val data = authService.findGroupDepartmentBySchoolNameContaining(schoolName, keyword, UserGroupType.UNIVERSITY,
91+
createPageable(page));
8792
return BaseResponse.success(DEPARTMENT_NAME_SEARCH_BY_SCHOOL_NAME_SCHOOL_SUCCESS, data);
8893
}
8994

@@ -92,4 +97,22 @@ public BaseResponse<ServiceTokenVO> postReIssueToken(@ServiceToken ServiceTokenV
9297
val data = authService.reIssueToken(tokens);
9398
return BaseResponse.success(RE_ISSUE_TOKEN_AUTH_SUCCESS, data);
9499
}
100+
101+
@GetMapping("/group/high/name")
102+
public BaseResponse<GroupNameSearchResponse> getHighSchoolList(
103+
@NotNull @RequestParam("keyword") String keyword,
104+
@NotNull @RequestParam("page") Integer page
105+
) {
106+
val data = authService.findGroupNameContaining(keyword, UserGroupType.HIGH_SCHOOL, createPageable(page));
107+
return BaseResponse.success(UNIVERSITY_NAME_SEARCH_USER_GROUP_SUCCESS, data);
108+
}
109+
110+
@GetMapping("/group/high/class")
111+
public BaseResponse<ClassNameSearchResponse> getHighSchoolClassName(
112+
@NotNull @RequestParam("name") String schoolName,
113+
@NotNull @RequestParam("keyword") String keyword
114+
) {
115+
val data = authService.getHighSchoolClassName(schoolName, keyword);
116+
return BaseResponse.success(CLASS_NAME_SEARCH_BY_SCHOOL_NAME_SCHOOL_SUCCESS, data);
117+
}
95118
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.yello.server.domain.authorization.dto.response;
2+
3+
import com.yello.server.domain.group.entity.UserGroup;
4+
import lombok.Builder;
5+
6+
@Builder
7+
public record ClassNameSearchResponse(
8+
Long groupId
9+
) {
10+
11+
public static ClassNameSearchResponse of(UserGroup userGroup) {
12+
return ClassNameSearchResponse.builder()
13+
.groupId(userGroup.getId())
14+
.build();
15+
}
16+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.yello.server.domain.authorization.dto.response;
22

3-
import com.yello.server.domain.group.entity.School;
3+
import com.yello.server.domain.group.entity.UserGroup;
44
import lombok.Builder;
55

66
@Builder
@@ -9,10 +9,10 @@ public record DepartmentInfo(
99
String departmentName
1010
) {
1111

12-
public static DepartmentInfo of(School school) {
12+
public static DepartmentInfo of(UserGroup userGroup) {
1313
return DepartmentInfo.builder()
14-
.groupId(school.getId())
15-
.departmentName(school.getDepartmentName())
14+
.groupId(userGroup.getId())
15+
.departmentName(userGroup.getSubGroupName())
1616
.build();
1717
}
1818
}

src/main/java/com/yello/server/domain/authorization/dto/response/DepartmentSearchResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.yello.server.domain.authorization.dto.response;
22

3-
import com.yello.server.domain.group.entity.School;
3+
import com.yello.server.domain.group.entity.UserGroup;
44
import java.util.List;
55
import lombok.Builder;
66

@@ -10,8 +10,8 @@ public record DepartmentSearchResponse(
1010
List<DepartmentInfo> groupList
1111
) {
1212

13-
public static DepartmentSearchResponse of(int totalCount, List<School> schoolList) {
14-
List<DepartmentInfo> departmentInfoList = schoolList.stream()
13+
public static DepartmentSearchResponse of(int totalCount, List<UserGroup> userGroupList) {
14+
List<DepartmentInfo> departmentInfoList = userGroupList.stream()
1515
.map(DepartmentInfo::of)
1616
.toList();
1717

src/main/java/com/yello/server/domain/authorization/service/AuthService.java

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import static com.yello.server.global.common.ErrorCode.TOKEN_ALL_EXPIRED_AUTH_EXCEPTION;
44
import static com.yello.server.global.common.ErrorCode.TOKEN_NOT_EXPIRED_AUTH_EXCEPTION;
55
import static com.yello.server.global.common.ErrorCode.YELLOID_REQUIRED_EXCEPTION;
6+
import static com.yello.server.global.common.util.ConstantUtil.RECOMMEND_POINT;
67

78
import com.yello.server.domain.authorization.dto.ServiceTokenVO;
89
import com.yello.server.domain.authorization.dto.kakao.KakaoTokenInfo;
910
import com.yello.server.domain.authorization.dto.request.OAuthRequest;
1011
import com.yello.server.domain.authorization.dto.request.OnBoardingFriendRequest;
1112
import com.yello.server.domain.authorization.dto.request.SignUpRequest;
13+
import com.yello.server.domain.authorization.dto.response.ClassNameSearchResponse;
1214
import com.yello.server.domain.authorization.dto.response.DepartmentSearchResponse;
1315
import com.yello.server.domain.authorization.dto.response.GroupNameSearchResponse;
1416
import com.yello.server.domain.authorization.dto.response.OAuthResponse;
@@ -21,8 +23,9 @@
2123
import com.yello.server.domain.friend.entity.Friend;
2224
import com.yello.server.domain.friend.repository.FriendRepository;
2325
import com.yello.server.domain.friend.service.FriendManager;
24-
import com.yello.server.domain.group.entity.School;
25-
import com.yello.server.domain.group.repository.SchoolRepository;
26+
import com.yello.server.domain.group.entity.UserGroup;
27+
import com.yello.server.domain.group.entity.UserGroupType;
28+
import com.yello.server.domain.group.repository.UserGroupRepository;
2629
import com.yello.server.domain.user.entity.User;
2730
import com.yello.server.domain.user.repository.UserRepository;
2831
import com.yello.server.domain.vote.service.VoteManager;
@@ -49,7 +52,7 @@
4952
public class AuthService {
5053

5154
private final UserRepository userRepository;
52-
private final SchoolRepository schoolRepository;
55+
private final UserGroupRepository userGroupRepository;
5356
private final FriendRepository friendRepository;
5457
private final CooldownRepository cooldownRepository;
5558
private final MessageQueueRepository messageQueueRepository;
@@ -86,7 +89,7 @@ public Boolean isYelloIdDuplicated(String yelloId) {
8689
@Transactional
8790
public SignUpResponse signUp(SignUpRequest signUpRequest) {
8891
authManager.validateSignupRequest(signUpRequest);
89-
final School group = schoolRepository.getById(signUpRequest.groupId());
92+
final UserGroup group = userGroupRepository.getById(signUpRequest.groupId());
9093

9194
final User newUser = userRepository.save(User.of(signUpRequest, group));
9295
newUser.setDeviceToken(signUpRequest.deviceToken());
@@ -107,9 +110,9 @@ public void recommendUser(String recommendYelloId, String userYelloId) {
107110
User recommendedUser = userRepository.getByYelloId(recommendYelloId);
108111
User user = userRepository.getByYelloId(userYelloId);
109112

110-
recommendedUser.increaseRecommendCount();
111-
recommendedUser.increaseRecommendPoint();
112-
user.increaseRecommendPoint();
113+
recommendedUser.addRecommendCount(1L);
114+
recommendedUser.addPoint(RECOMMEND_POINT);
115+
user.addPoint(RECOMMEND_POINT);
113116

114117
notificationService.sendRecommendNotification(user, recommendedUser);
115118

@@ -129,7 +132,7 @@ public void makeFriend(User user, List<Long> friendIds) {
129132
Friend savedFriend =
130133
friendRepository.save(Friend.createFriend(user, friend.get()));
131134
friendRepository.save(Friend.createFriend(friend.get(), user));
132-
135+
133136
notificationService.sendFriendNotification(savedFriend);
134137
}
135138
});
@@ -147,19 +150,24 @@ public OnBoardingFriendResponse findOnBoardingFriends(OnBoardingFriendRequest fr
147150
return OnBoardingFriendResponse.of(kakaoFriends.size(), pageList);
148151
}
149152

150-
public GroupNameSearchResponse findSchoolsByKeyword(String keyword, Pageable pageable) {
151-
int totalCount = schoolRepository.countDistinctSchoolNameContaining(keyword);
152-
final List<String> nameList = schoolRepository.findDistinctSchoolNameContaining(keyword,
153-
pageable);
153+
public GroupNameSearchResponse findGroupNameContaining(String keyword, UserGroupType userGroupType,
154+
Pageable pageable) {
155+
int totalCount = userGroupRepository.countDistinctGroupNameContaining(keyword, userGroupType);
156+
final List<String> nameList = userGroupRepository.findDistinctGroupNameContaining(keyword, userGroupType,
157+
pageable)
158+
.stream()
159+
.toList();
160+
154161
return GroupNameSearchResponse.of(totalCount, nameList);
155162
}
156163

157-
public DepartmentSearchResponse findDepartmentsByKeyword(String schoolName, String keyword,
158-
Pageable pageable) {
159-
int totalCount = schoolRepository.countAllBySchoolNameContaining(schoolName, keyword);
160-
final List<School> schoolResult = schoolRepository.findAllBySchoolNameContaining(schoolName,
161-
keyword, pageable);
162-
return DepartmentSearchResponse.of(totalCount, schoolResult);
164+
public DepartmentSearchResponse findGroupDepartmentBySchoolNameContaining(String schoolName, String keyword,
165+
UserGroupType userGroupType, Pageable pageable) {
166+
int totalCount = userGroupRepository.countAllByGroupNameContaining(schoolName, keyword, userGroupType);
167+
final List<UserGroup> userGroupResult = userGroupRepository.findAllByGroupNameContaining(schoolName, keyword,
168+
userGroupType, pageable);
169+
170+
return DepartmentSearchResponse.of(totalCount, userGroupResult);
163171
}
164172

165173
@Transactional
@@ -179,4 +187,10 @@ public ServiceTokenVO reIssueToken(@NotNull ServiceTokenVO tokens) {
179187

180188
throw new NotExpiredTokenForbiddenException(TOKEN_NOT_EXPIRED_AUTH_EXCEPTION);
181189
}
190+
191+
public ClassNameSearchResponse getHighSchoolClassName(String schoolName, String className) {
192+
UserGroup userGroup =
193+
userGroupRepository.getByGroupNameAndSubGroupName(schoolName, className, UserGroupType.HIGH_SCHOOL);
194+
return ClassNameSearchResponse.of(userGroup);
195+
}
182196
}

src/main/java/com/yello/server/domain/friend/dto/response/FriendResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static FriendResponse of(User user) {
1515
return FriendResponse.builder()
1616
.id(user.getId())
1717
.name(user.getName())
18-
.group(user.groupString())
18+
.group(user.toGroupString())
1919
.profileImage(user.getProfileImage())
2020
.build();
2121
}

src/main/java/com/yello/server/domain/friend/dto/response/SearchFriendVO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static SearchFriendVO of(User user, Boolean isFriend) {
1717
return SearchFriendVO.builder()
1818
.id(user.getId())
1919
.name(user.getName())
20-
.group(user.groupString())
20+
.group(user.toGroupString())
2121
.profileImage(user.getProfileImage())
2222
.yelloId(user.getYelloId())
2323
.isFriend(isFriend)

src/main/java/com/yello/server/domain/friend/service/FriendService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public RecommendFriendResponse findAllRecommendSchoolFriends(Pageable pageable,
8484
final User user = userRepository.getById(userId);
8585

8686
List<User> recommendFriends =
87-
userRepository.findAllByGroupId(user.getGroup().getSchoolName())
87+
userRepository.findAllByGroupId(user.getGroup().getId())
8888
.stream()
8989
.filter(target -> !userId.equals(target.getId()))
9090
.filter(target -> !friendRepository.existsByUserAndTarget(userId, target.getId()))
@@ -131,12 +131,12 @@ public RecommendFriendResponse findAllRecommendKakaoFriends(Pageable pageable, L
131131
public SearchFriendResponse searchFriend(Long userId, Pageable pageable,
132132
String keyword) {
133133
final User user = userRepository.getById(userId);
134-
final String groupName = user.getGroup().getSchoolName();
134+
final String groupName = user.getGroup().getGroupName();
135135
List<String> uuidList = Arrays.asList(YELLO_FEMALE, YELLO_MALE);
136136

137137
List<User> friendList = new ArrayList<>();
138138

139-
if (keyword==null || keyword.trim().isEmpty()) {
139+
if (keyword == null || keyword.trim().isEmpty()) {
140140
return SearchFriendResponse.of(0, Collections.emptyList());
141141
}
142142

@@ -165,7 +165,7 @@ public SearchFriendResponse searchFriend(Long userId, Pageable pageable,
165165

166166
public boolean isEnglish(String keyword) {
167167
for (char c : keyword.toCharArray()) {
168-
if (Character.UnicodeBlock.of(c)!=UnicodeBlock.BASIC_LATIN) {
168+
if (Character.UnicodeBlock.of(c) != UnicodeBlock.BASIC_LATIN) {
169169
return false;
170170
}
171171
}

0 commit comments

Comments
 (0)