package com.expensetracker.api.expenses.repository;

import com.expensetracker.api.expenses.model.Expense;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.time.LocalDate;

public interface ExpenseRepository extends JpaRepository<Expense, Long> {
  Page<Expense> findByUserIdAndExpenseDateBetweenOrderByCreatedAtDesc(
      Long userId, LocalDate from, LocalDate to, Pageable pageable
  );

  Page<Expense> findByUserIdOrderByCreatedAtDesc(Long userId, Pageable pageable);
}
