package hozza.network.models.twitch.repositories;

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

import hozza.network.models.twitch.entities.MariaPerson;

public interface MariaPersonRepository extends JpaRepository<MariaPerson, Integer>
{
    @Query(value = "SELECT COUNT(*) FROM person", nativeQuery = true)
    long getPersonCount();

    @Query(value = "SELECT COUNT(*) FROM person WHERE date_added BETWEEN NOW() - INTERVAL (HOUR(NOW())*60*60+MINUTE(NOW())*60+SECOND(NOW())) SECOND AND NOW()", nativeQuery = true)
    long getPersonCountToday();
}
