package com.izouma.nineth.service;

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

@Service
@AllArgsConstructor
public class ActivityService {

    private ActivityRepo activityRepo;

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