Interface CoasterRepository
- All Superinterfaces:
org.springframework.data.repository.reactive.ReactiveCrudRepository<Coaster,
,String> org.springframework.data.repository.Repository<Coaster,
String>
@Repository
public interface CoasterRepository
extends org.springframework.data.repository.reactive.ReactiveCrudRepository<Coaster,String>
Repository of
Coaster
, used to store coaster details and device state.-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Long>
countByOwner
(String owner) Fetch the count of coasters assigned to the specified user.reactor.core.publisher.Mono<Long>
Fetch the count of coasters that are not assigned to any user.<S extends Coaster>
reactor.core.publisher.Mono<S>Create a coaster with the given device ID, inactivity time and timezone.reactor.core.publisher.Flux<Coaster>
findAllByOwner
(String owner, org.springframework.data.domain.Pageable pageable) Fetch coaster entities assigned to the specified user.reactor.core.publisher.Flux<Coaster>
findAllByOwnerIsNull
(org.springframework.data.domain.Pageable pageable) Fetch coaster entities that are not assigned to any user.reactor.core.publisher.Mono<Coaster>
findByDeviceNameAndOwner
(String deviceName, String owner) Fetch the coaster entity by device ID.Methods inherited from interface org.springframework.data.repository.reactive.ReactiveCrudRepository
count, delete, deleteAll, deleteAll, deleteAll, deleteAllById, deleteById, deleteById, existsById, existsById, findAll, findAllById, findAllById, findById, findById, save, saveAll, saveAll
-
Method Details
-
findAllByOwnerIsNull
reactor.core.publisher.Flux<Coaster> findAllByOwnerIsNull(org.springframework.data.domain.Pageable pageable) Fetch coaster entities that are not assigned to any user.- Parameters:
pageable
- the page descriptor- Returns:
Flux
ofCoaster
entities
-
countByOwnerIsNull
reactor.core.publisher.Mono<Long> countByOwnerIsNull()Fetch the count of coasters that are not assigned to any user.- Returns:
- the coaster count
-
findAllByOwner
reactor.core.publisher.Flux<Coaster> findAllByOwner(String owner, org.springframework.data.domain.Pageable pageable) Fetch coaster entities assigned to the specified user.- Parameters:
owner
- the owner's usernamepageable
- the page descriptor- Returns:
Flux
ofCoaster
entities
-
countByOwner
Fetch the count of coasters assigned to the specified user.- Parameters:
owner
- the owner's username- Returns:
- the coaster count
-
findByDeviceNameAndOwner
Fetch the coaster entity by device ID.- Parameters:
deviceName
- the device IDowner
- the coaster owner's username- Returns:
- the coaster entity
-
create
@Query("insert into coasters (device_name, inactive_since, timezone)\nvalues (:device_name, :now, :timezone) returning *") <S extends Coaster> reactor.core.publisher.Mono<S> create(String deviceName, Instant now, ZoneId timezone) Create a coaster with the given device ID, inactivity time and timezone.- Type Parameters:
S
- the coaster type- Parameters:
deviceName
- the device IDnow
- the inactivity timetimezone
- the coaster's timezone- Returns:
- the new coaster entity
-