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.MediaVideo;

import java.util.List;

public interface MediaVideoRepository extends JpaRepository<MediaVideo, String> {

    @Query("select m from MediaVideo m " +
            "where lower(m.url) like lower(concat('%', :searchTerm, '%')) or lower(m.title) like lower(concat('%', :searchTerm, '%'))")
    List<MediaVideo> search(@Param("searchTerm") String searchTerm);

}
