Skip to content

Commit

Permalink
Merge pull request #208 from WE-ARE-RACCOONS/RAC-326
Browse files Browse the repository at this point in the history
RAC-326 HotFix : μ„ λ°° μžμ‹ μ˜ μ‹œκ°„ μ‘°νšŒμ‹œ 인증여뢀 상관없이 쑰회 κ°€λŠ₯ν•˜λ„λ‘ λ³€κ²½
  • Loading branch information
ywj9811 authored Apr 2, 2024
2 parents 748c7ae + 1c4e9e9 commit 0807b2d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface AvailableDslRepository {
List<Available> findAllBySenior(Senior senior);
List<Available> findAllByMine(Senior senior);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ public List<Available> findAllBySenior(Senior senior) {
.where(available.senior.eq(senior), available.senior.status.eq(APPROVE))
.fetch();
}

@Override
public List<Available> findAllByMine(Senior senior) {
return queryFactory.selectFrom(available)
.distinct()
.where(available.senior.eq(senior))
.fetch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ public class AvailableGetService {
public List<Available> bySenior(Senior senior) {
return availableRepository.findAllBySenior(senior);
}

public List<Available> byMine(Senior senior) {
return availableRepository.findAllByMine(senior);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public Optional<Mentoring> findByMentoringId(Long mentoringId) {
@Override
public List<Mentoring> findAllBySeniorAndSalaryStatus(Senior senior, Boolean status) {
return queryFactory.selectFrom(mentoring)
.distinct()
.where(
mentoring.senior.eq(senior),
mentoring.status.eq(Status.DONE),
Expand All @@ -112,13 +113,14 @@ public List<Mentoring> findAllBySeniorAndSalaryStatus(Senior senior, Boolean sta
@Override
public Page<Mentoring> findAllBySearchPayment(String search, Pageable pageable) {
List<Mentoring> mentorings = queryFactory.selectFrom(mentoring)
.distinct()
.where(
searchLike(search),
mentoring.user.isDelete.eq(FALSE)
)
.join(mentoring.user, user)
.leftJoin(mentoring.user, user)
.fetchJoin()
.join(mentoring.payment, payment)
.leftJoin(mentoring.payment, payment)
.fetchJoin()
.orderBy(mentoring.payment.paidAt.desc())
.offset(pageable.getOffset())
Expand Down Expand Up @@ -150,9 +152,9 @@ private BooleanExpression searchLike(String search) {
public List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now) {
return queryFactory.selectFrom(mentoring)
.distinct()
.join(mentoring.user, user)
.leftJoin(mentoring.user, user)
.fetchJoin()
.join(mentoring.payment, payment)
.leftJoin(mentoring.payment, payment)
.fetchJoin()
.where(mentoring.status.eq(status), mentoring.createdAt.before(now))
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class PaymentDslRepositoryImpl implements PaymentDslRepository {
public List<Payment> findAllPayment() {
return queryFactory.selectFrom(payment)
.distinct()
.join(payment.user, user)
.leftJoin(payment.user, user)
.fetchJoin()
.fetch();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public Page<SeniorSalary> findDistinctBySearchSenior(String search, Pageable pag
)
)
.from(salary)
.distinct()
.where(
searchLike(search),
salary.senior.user.isDelete.eq(FALSE)
Expand Down Expand Up @@ -86,9 +87,9 @@ public List<Salary> findAllLastSalary(LocalDate salaryDate) {
return queryFactory.selectFrom(salary)
.distinct()
.where(salary.salaryDate.eq(salaryDate))
.join(salary.senior, senior)
.leftJoin(salary.senior, senior)
.fetchJoin()
.join(salary.senior.user, user)
.leftJoin(salary.senior.user, user)
.fetchJoin()
.fetch();
}
Expand All @@ -102,9 +103,9 @@ public List<Salary> findAllByNotDoneFromLast(LocalDate salaryDate) {
salary.salaryDate.lt(salaryDate),
salary.totalAmount.gt(0)
)
.join(salary.senior, senior)
.leftJoin(salary.senior, senior)
.fetchJoin()
.join(senior.user, user)
.leftJoin(senior.user, user)
.fetchJoin()
.orderBy(salary.salaryDate.asc())
.fetch();
Expand All @@ -115,9 +116,9 @@ public List<Salary> findAllByDone() {
return queryFactory.selectFrom(salary)
.distinct()
.where(salary.status.isTrue())
.join(salary.senior, senior)
.leftJoin(salary.senior, senior)
.fetchJoin()
.join(senior.user, user)
.leftJoin(senior.user, user)
.fetchJoin()
.where(salary.totalAmount.gt(0))
.orderBy(salary.salaryDoneDate.desc())
Expand All @@ -139,7 +140,7 @@ public List<Salary> findAllBySalaryNoneAccount(LocalDate salaryDate, Senior sear
salary.senior.eq(searchSenior)
.and(salary.account.isNull())
)
.join(salary.senior, senior)
.leftJoin(salary.senior, senior)
.fetchJoin()
.fetch();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private SeniorDetailResponse getResponse(Long seniorId, boolean isMine) {
}

private SeniorDetailResponse getResponseMine(Senior senior, boolean isMine) {
List<Available> availables = availableGetService.bySenior(senior);
List<Available> availables = availableGetService.byMine(senior);
List<AvailableTimeResponse> times = availables.stream()
.map(AvailableMapper::mapToAvailableTimes)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public SeniorMyPageProfileResponse getSeniorMyPageProfile(User user) {
if (senior.getProfile() == null) {
throw new NoneProfileException();
}
List<Available> availables = availableGetService.bySenior(senior);
List<Available> availables = availableGetService.byMine(senior);
List<AvailableTimeResponse> times = availables.stream()
.map(AvailableMapper::mapToAvailableTimes)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public List<SeniorAndAccount> findAllSeniorAndAccount() {
public List<Senior> findAllSenior() {
return queryFactory.selectFrom(senior)
.distinct()
.join(senior.user, user)
.leftJoin(senior.user, user)
.fetchJoin()
.where(senior.user.isDelete.eq(FALSE))
.orderBy(senior.user.nickName.asc())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class WishDslRepositoryImpl implements WishDslRepository {
public Page<Wish> findAllBySearchWish(String search, Pageable pageable) {
List<Wish> wishes = queryFactory.selectFrom(wish)
.distinct()
.join(wish.user, user)
.leftJoin(wish.user, user)
.fetchJoin()
.where(
searchLike(search),
Expand Down Expand Up @@ -58,7 +58,7 @@ private BooleanExpression searchLike(String search) {
public List<Wish> findAllWish() {
return queryFactory.selectFrom(wish)
.distinct()
.join(wish.user, user)
.leftJoin(wish.user, user)
.fetchJoin()
.where(wish.user.isDelete.isFalse())
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void getSeniorMyPageProfile() {

given(seniorGetService.byUser(user))
.willReturn(senior);
given(availableGetService.bySenior(senior))
given(availableGetService.byMine(senior))
.willReturn(availables);

SeniorMyPageProfileResponse myPageProfile = seniorMyPageUseCase.getSeniorMyPageProfile(user);
Expand Down

0 comments on commit 0807b2d

Please sign in to comment.