package com.infinite.focus.server.tests;
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.auth.Student;
import com.infinite.focus.server.wall.WallPost;

//Handles CRUD operations for quotes table



@Repository
public interface SocioEmotionalTestResultRepository extends JpaRepository<SocioEmotionalTestResult, Long> {
	
			@Query(value = "SELECT * FROM socio_emotional_test_result WHERE student_id = ?1 ORDER BY created_at", nativeQuery = true)
			List<SocioEmotionalTestResult> findByStudentId(Long student_id);	
			
			
			@Query(value = "SELECT * FROM socio_emotional_test_result WHERE student_id = ?1 ORDER BY created_at LIMIT 0, 1;", nativeQuery = true)
			SocioEmotionalTestResult findMostRecentByStudentId(Long student_id);
			
			@Query(value = "SELECT * FROM socio_emotional_test_result WHERE student_id = ?1 ORDER BY socio_emotional_test_result_id DESC", nativeQuery = true)
			List<SocioEmotionalTestResult> findByStudentIdOrderByCreatedAtLatestToOldest(Long student_id);	
}