Changeset 77205be for src/main/java/edu/gjoko/schedlr/repositories
- Timestamp:
- 12/26/23 18:50:43 (11 months ago)
- Branches:
- master
- Children:
- 1413ee2
- Parents:
- 950fa0d
- Location:
- src/main/java/edu/gjoko/schedlr/repositories
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/repositories/AppointmentRepository.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 2 2 3 3 import edu.gjoko.schedlr.entity.Appointment; 4 import edu.gjoko.schedlr.entity.Business;5 4 import edu.gjoko.schedlr.entity.Stakeholder; 6 5 import org.springframework.data.jpa.repository.JpaRepository; … … 10 9 import java.time.LocalDateTime; 11 10 import java.util.List; 11 import java.util.Optional; 12 12 13 13 @Repository 14 14 public interface AppointmentRepository extends JpaRepository<Appointment, Long> { 15 15 16 List<Appointment> getAppointmentsByBusiness(Business business); 16 @Query(value = "select ap from Appointment as ap " + 17 "where ap.service.business.id = :businessId " + 18 "and ap.appointmentStatus = 'NEW'") 19 List<Appointment> getActiveAppointmentsByBusiness(Long businessId); 17 20 18 List<Appointment> getAppointmentsByCustomer(Stakeholder customer); 21 @Query( value = "select ap from Appointment as ap " + 22 "where ap.service.business.id = :businessId " + 23 "and (" + 24 "(ap.startTime between :startDate and :endDate) " + 25 "or (ap.endTime between :startDate and :endDate) " + 26 "or (:startDate = ap.startTime and ap.startTime = :endDate)" + 27 "or (:startDate > ap.startTime and ap.endTime > :endDate)" + 28 ")") 29 List<Appointment> findBlockingAppointments(Long businessId, LocalDateTime startDate, LocalDateTime endDate); 19 30 20 List<Appointment> findAppointmentsByBusinessAndStartTimeBetweenOrEndTimeBetween(Business business, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime startTime1, LocalDateTime endTime1); 31 @Query(value = "select ap from Appointment as ap " + 32 "where ap.service.business.owner.id = :businessOwnerId " + 33 "and ap.startTime > :now ") 34 List<Appointment> findFutureAppointmentsByBusinessOwnerId(Long businessOwnerId, LocalDateTime now); 21 35 22 @Query(value = "select a from Appointment a " + 23 "where business_id = :businessId " + 24 "and (" + 25 "(start_time between :startDate and :endDate) " + 26 "or (end_time between :startDate and :endDate) " + 27 "or (:startDate <= start_time and end_time >= :endDate)" + 28 ")", nativeQuery = true) 29 List<Appointment> findBlockingAppointments(Long businessId, LocalDateTime startDate, LocalDateTime endDate); 36 @Query(value = "select ap from Appointment as ap " + 37 "where ap.customer.id = :customerId " + 38 "and ap.startTime < :now") 39 List<Appointment> findPastAppointmentsByCustomerId(Long customerId, LocalDateTime now); 40 41 @Query(value = "select ap from Appointment as ap " + 42 "where ap.service.business.owner.id = :businessOwnerId " + 43 "and ap.startTime < :now ") 44 List<Appointment> findPastAppointmentsByBusinessOwnerId(Long businessOwnerId, LocalDateTime now); 45 46 @Query(value = "select ap from Appointment as ap " + 47 "where ap.customer.id = :customerId " + 48 "and ap.startTime > :now ") 49 List<Appointment> findFutureAppointmentsByCustomerId(Long customerId, LocalDateTime now); 50 51 Optional<Appointment> findAppointmentByIdAndCustomer_Id(Long id, Long customerId); 52 53 Optional<Appointment> findAppointmentByIdAndService_Business_Owner_Id(Long id, Long ownerId); 30 54 } -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/repositories/BusinessRepository.java
-
Property mode
changed from
100644
to100755
r950fa0d r77205be 17 17 18 18 List<Business> findBusinessesByBusinessTypeAndBusinessStatus(BusinessType businessType, BusinessStatus businessStatus); 19 20 List<Business> findBusinessesByBusinessStatusAndBusinessType_Id(BusinessStatus businessStatus, Long id); 19 21 } -
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/repositories/BusinessTypeRepository.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/repositories/ServiceRepository.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/repositories/ServiceTypeRepository.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
-
src/main/java/edu/gjoko/schedlr/repositories/StakeholderRepository.java
-
Property mode
changed from
100644
to100755
-
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.