Implement to query accounts for a given user

This commit is contained in:
Marcel Schwarz 2020-05-25 14:11:34 +02:00
parent 83bd086792
commit 781ec85851

View File

@ -1,6 +1,8 @@
package de.hft.geotime.repositories; package de.hft.geotime.repositories;
import de.hft.geotime.entities.TimetrackAccount; import de.hft.geotime.entities.TimetrackAccount;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.data.rest.core.annotation.RestResource;
@ -15,4 +17,7 @@ public interface TimetrackAccountRepository extends PagingAndSortingRepository<T
@RestResource(rel = "findByUsernameAndName", path = "findByUsernameAndName") @RestResource(rel = "findByUsernameAndName", path = "findByUsernameAndName")
TimetrackAccount findByUser_UsernameAndName(String username, String account); TimetrackAccount findByUser_UsernameAndName(String username, String account);
@RestResource(rel = "findByUsername", path = "findByUsername")
Page<TimetrackAccount> findAllByUser_Username(String username, Pageable pageable);
} }