package de.thpeetz.kontor.media.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import de.thpeetz.kontor.media.data.MediaArticle;

import java.util.List;

public interface MediaArticleRepository extends JpaRepository<MediaArticle, String> {
    @Query("select m from MediaArticle m " +
            "where lower(m.url) like lower(concat('%', :searchTerm, '%')) or lower(m.title) like lower(concat('%', :searchTerm, '%'))")
    List<MediaArticle> search(@Param("searchTerm") String searchTerm);
}
