package com.izouma.nineth.service;

import com.izouma.nineth.domain.CollectionPrivilege;
import com.izouma.nineth.dto.PageQuery;
import com.izouma.nineth.repo.CollectionPrivilegeRepo;
import com.izouma.nineth.utils.JpaUtils;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class CollectionPrivilegeService {

    private CollectionPrivilegeRepo collectionPrivilegeRepo;

    public Page<CollectionPrivilege> all(PageQuery pageQuery) {
        return collectionPrivilegeRepo.findAll(JpaUtils.toSpecification(pageQuery, CollectionPrivilege.class), JpaUtils.toPageRequest(pageQuery));
    }
}
