package com.example.backend.categories.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.example.backend.categories.model.CategoryEntity;

public interface CategoryRepository extends CrudRepository<CategoryEntity, Long> {
    Optional<CategoryEntity> findByNameIgnoreCase(String name);

    @Query("SELECT c FROM CategoryEntity c")
    List<CategoryEntity> findAll(Sort sort);
}
