Skip to content

Commit

Permalink
Merge pull request #147 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
RAC-304 deploy : μš΄μ˜μ„œλ²„ 반영
  • Loading branch information
ywj9811 authored Mar 2, 2024
2 parents da0a9d9 + 4484d8e commit b1462d1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void delete(User user, Long mentoringId) {
mentoringDeleteService.deleteMentoring(mentoring);
}

@Scheduled(cron = "0 46 01 * * *", zone = "Asia/Seoul")
@Scheduled(fixedDelay = 120000, zone = "Asia/Seoul")
public void updateAutoCancel() {
LocalDateTime now = LocalDateTime.now()
.toLocalDate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

Expand All @@ -20,4 +21,6 @@ public interface MentoringDslRepository {
List<Mentoring> findAllBySeniorAndSalaryStatus(Senior senior, Boolean status);

Page<Mentoring> findAllBySearchPayment(String search, Pageable pageable);

List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -159,4 +160,16 @@ private BooleanExpression searchLike(String search) {
}
return null;
}

@Override
public List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now) {
return queryFactory.selectFrom(mentoring)
.distinct()
.join(mentoring.user, user)
.fetchJoin()
.join(mentoring.payment, payment)
.fetchJoin()
.where(mentoring.status.eq(status), mentoring.createdAt.before(now))
.fetch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import com.postgraduate.domain.payment.domain.entity.Payment;
import org.springframework.data.jpa.repository.JpaRepository;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

public interface MentoringRepository extends JpaRepository<Mentoring, Long>, MentoringDslRepository {
List<Mentoring> findAllByStatus(Status status);
List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now);
Optional<Mentoring> findByPayment(Payment payment);
}

0 comments on commit b1462d1

Please sign in to comment.