package de.thpeetz.kontor.admin.repository;

import de.thpeetz.kontor.admin.data.Profile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ProfileRepository extends JpaRepository<Profile, String> {

    @Query("select p from Profile p " +
            "where lower(p.lastName) like lower(concat('%', :searchTerm, '%')) ")
    List<Profile> search(@Param("searchTerm") String searchTerm);

    Profile findByUserName(String userName);
}
