Auto-assign room image order on upload
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s

This commit is contained in:
androidlover5842
2026-01-27 16:33:26 +05:30
parent 6b4cac0235
commit 9049face76
2 changed files with 10 additions and 4 deletions

View File

@@ -17,4 +17,10 @@ interface RoomImageRepo : JpaRepository<RoomImage, UUID> {
)
fun findByRoomIdOrdered(@Param("roomId") roomId: UUID): List<RoomImage>
fun findByIdAndRoomIdAndPropertyId(id: UUID, roomId: UUID, propertyId: UUID): RoomImage?
@Query("select coalesce(max(ri.roomSortOrder), 0) from RoomImage ri where ri.room.id = :roomId")
fun findMaxRoomSortOrder(@Param("roomId") roomId: UUID): Int
@Query("select coalesce(max(ri.roomTypeSortOrder), 0) from RoomImage ri where ri.roomTypeCode = :roomTypeCode")
fun findMaxRoomTypeSortOrder(@Param("roomTypeCode") roomTypeCode: String): Int
}