package com.izouma.nineth.service;

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

@Service
@AllArgsConstructor
public class AssetPostService {

    private AssetPostRepo assetPostRepo;

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