package com.infinite.focus.server.home;
import java.util.List;

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

import com.infinite.focus.server.auth.Instructor;
import com.infinite.focus.server.wall.WallPost;

//Handles CRUD operations for quotes table



@Repository
public interface DailyAppreciationRepository extends JpaRepository<DailyAppreciation, Long> {
	
	@Query(value = "SELECT * FROM daily_appreciation WHERE student_id = ?1 AND createdAt >= DATE_SUB(Now(),INTERVAL 1 day ORDER BY created_at DESC", nativeQuery = true)
	List<DailyAppreciation> findByStudentForToday(Long student_id);
	
	@Query(value = "SELECT * FROM daily_appreciation WHERE student_id = ?1 ORDER BY created_at DESC", nativeQuery = true)
	List<DailyAppreciation> findByStudent(Long student_id);

}