Skip to content
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

YEL-152 [deploy] 1.1.91v #298

Merged
merged 6 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ public List<FriendShuffleResponse> findShuffledFriend(Long userId) {
public RecommendFriendResponse findAllRecommendSchoolFriends(Pageable pageable, Long userId) {
final User user = userRepository.getById(userId);

List<User> recommendFriends = userRepository.findAllByGroupId(user.getGroup().getId())
.stream()
.filter(target -> !userId.equals(target.getId()))
.filter(target -> !friendRepository.existsByUserAndTarget(userId, target.getId()))
.toList();
List<User> recommendFriends =
userRepository.findAllByGroupId(user.getGroup().getSchoolName())
.stream()
.filter(target -> !userId.equals(target.getId()))
.filter(target -> !friendRepository.existsByUserAndTarget(userId, target.getId()))
.toList();

List<FriendResponse> pageList = PaginationFactory.getPage(recommendFriends, pageable)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public GoogleSubscriptionGetResponse verifyGoogleSubscriptionTransaction(Long us
case ConstantUtil.GOOGLE_PURCHASE_SUBSCRIPTION_ACTIVE -> {
final Purchase subscribe =
purchaseManager.createSubscribe(user, Gateway.GOOGLE, request.orderId());
user.addTicketCount(3);
subscribe.setTransactionId(request.orderId());
}
}
Expand Down Expand Up @@ -239,7 +240,6 @@ public GoogleTicketGetResponse verifyGoogleTicketTransaction(Long userId,
if (!inAppResponse.getStatusCode().is2xxSuccessful()) {
throw new GoogleTokenServerErrorException(GOOGLE_TOKEN_SERVER_EXCEPTION);
}
System.out.println("inAppResponse = " + inAppResponse);

if (inAppResponse.getBody().purchaseState() == 0) {
purchaseRepository.findByTransactionId(inAppResponse.getBody().orderId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public interface UserJpaRepository extends JpaRepository<User, Long> {
Optional<User> findByYelloIdNotFiltered(@Param("yelloId") String yelloId);

@Query("select u from User u " +
"where u.group.id = :groupId " +
"where u.group.schoolName = :schoolName " +
"and u.deletedAt is null")
List<User> findAllByGroupId(@Param("groupId") Long groupId);
List<User> findAllByGroupId(@Param("schoolName") String schoolName);


@Query("select u from User u "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface UserRepository {

Optional<User> findByDeviceTokenNotFiltered(String deviceToken);

List<User> findAllByGroupId(Long groupId);
List<User> findAllByGroupId(String schoolName);

List<User> findAllByGroupContainingName(String groupName, String keyword,
List<String> uuidList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public Optional<User> findByDeviceTokenNotFiltered(String deviceToken) {
}

@Override
public List<User> findAllByGroupId(Long groupId) {
return userJpaRepository.findAllByGroupId(groupId);
public List<User> findAllByGroupId(String schoolName) {
return userJpaRepository.findAllByGroupId(schoolName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class FakeUserRepository implements UserRepository {

@Override
public User save(User user) {
if (user.getId() != null && user.getId() > id) {
if (user.getId()!=null && user.getId() > id) {
id = user.getId();
}

User newUser = User.builder()
.id(user.getId() == null ? ++id : user.getId())
.id(user.getId()==null ? ++id : user.getId())
.recommendCount(0L)
.name(user.getName())
.yelloId(user.getYelloId())
Expand Down Expand Up @@ -93,7 +93,7 @@ public boolean existsByUuid(String uuid) {
@Override
public Optional<User> findByYelloId(String yelloId) {
return data.stream()
.filter(user -> user.getDeletedAt() == null)
.filter(user -> user.getDeletedAt()==null)
.filter(user -> user.getYelloId().equals(yelloId))
.findFirst();
}
Expand Down Expand Up @@ -128,9 +128,9 @@ public Optional<User> findByDeviceTokenNotFiltered(String deviceToken) {
}

@Override
public List<User> findAllByGroupId(Long groupId) {
public List<User> findAllByGroupId(String schoolName) {
return data.stream()
.filter(user -> user.getGroup().getId().equals(groupId))
.filter(user -> user.getGroup().getSchoolName().equals(schoolName))
.toList();
}

Expand Down
Loading