package com.izouma.nineth.service;

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

@Service
@AllArgsConstructor
public class DestroyRecordService {

    private DestroyRecordRepo destroyRecordRepo;

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