package com.izouma.nineth.service;

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

@Service
@AllArgsConstructor
public class UserAddressService {

    private UserAddressRepo userAddressRepo;

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