Add rate plans, room stay rates, and payments ledger
All checks were successful
build-and-deploy / build-deploy (push) Successful in 34s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 34s
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.android.trisolarisserver.repo
|
||||
|
||||
import com.android.trisolarisserver.models.booking.Payment
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.query.Param
|
||||
import java.util.UUID
|
||||
|
||||
interface PaymentRepo : JpaRepository<Payment, UUID> {
|
||||
fun findByBookingIdOrderByReceivedAtDesc(bookingId: UUID): List<Payment>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
select coalesce(sum(p.amount), 0)
|
||||
from Payment p
|
||||
where p.booking.id = :bookingId
|
||||
"""
|
||||
)
|
||||
fun sumAmountByBookingId(@Param("bookingId") bookingId: UUID): Long
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.android.trisolarisserver.repo
|
||||
|
||||
import com.android.trisolarisserver.models.room.RateCalendar
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.time.LocalDate
|
||||
import java.util.UUID
|
||||
|
||||
interface RateCalendarRepo : JpaRepository<RateCalendar, UUID> {
|
||||
fun findByRatePlanIdAndRateDateBetweenOrderByRateDateAsc(
|
||||
ratePlanId: UUID,
|
||||
from: LocalDate,
|
||||
to: LocalDate
|
||||
): List<RateCalendar>
|
||||
|
||||
fun findByRatePlanIdAndRateDate(ratePlanId: UUID, rateDate: LocalDate): RateCalendar?
|
||||
fun findByRatePlanIdAndRateDateIn(ratePlanId: UUID, dates: List<LocalDate>): List<RateCalendar>
|
||||
fun findByRatePlanId(ratePlanId: UUID): List<RateCalendar>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.android.trisolarisserver.repo
|
||||
|
||||
import com.android.trisolarisserver.models.room.RatePlan
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.util.UUID
|
||||
|
||||
interface RatePlanRepo : JpaRepository<RatePlan, UUID> {
|
||||
fun findByPropertyIdOrderByCode(propertyId: UUID): List<RatePlan>
|
||||
fun findByIdAndPropertyId(id: UUID, propertyId: UUID): RatePlan?
|
||||
fun existsByPropertyIdAndCode(propertyId: UUID, code: String): Boolean
|
||||
}
|
||||
@@ -36,6 +36,13 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
|
||||
""")
|
||||
fun findActiveByBookingId(@Param("bookingId") bookingId: UUID): List<RoomStay>
|
||||
|
||||
@Query("""
|
||||
select rs
|
||||
from RoomStay rs
|
||||
where rs.booking.id = :bookingId
|
||||
""")
|
||||
fun findByBookingId(@Param("bookingId") bookingId: UUID): List<RoomStay>
|
||||
|
||||
@Query("""
|
||||
select rs.room.id
|
||||
from RoomStay rs
|
||||
|
||||
Reference in New Issue
Block a user