|
|
@ -2,22 +2,27 @@ package fr.iut.sciencequest.sae.services;
|
|
|
|
|
|
|
|
|
|
|
|
import fr.iut.sciencequest.sae.entities.Question;
|
|
|
|
import fr.iut.sciencequest.sae.entities.Question;
|
|
|
|
import fr.iut.sciencequest.sae.repositories.QuestionRepository;
|
|
|
|
import fr.iut.sciencequest.sae.repositories.QuestionRepository;
|
|
|
|
|
|
|
|
import fr.iut.sciencequest.sae.repositories.ReponseRepository;
|
|
|
|
import fr.iut.sciencequest.sae.services.interfaces.IQuestionService;
|
|
|
|
import fr.iut.sciencequest.sae.services.interfaces.IQuestionService;
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class QuestionService implements IQuestionService {
|
|
|
|
public class QuestionService implements IQuestionService {
|
|
|
|
private final QuestionRepository questionRepository;
|
|
|
|
private final QuestionRepository questionRepository;
|
|
|
|
|
|
|
|
private final ReponseRepository reponseRepository;
|
|
|
|
public QuestionService(QuestionRepository questionRepository) {
|
|
|
|
|
|
|
|
this.questionRepository = questionRepository;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Page<Question> findAll(Pageable p) {
|
|
|
|
public Page<Question> findAll(Pageable p) {
|
|
|
|
//Pageable paging = PageRequest.of(page, PAGE_SIZE);
|
|
|
|
|
|
|
|
return questionRepository.findAll(p);
|
|
|
|
return questionRepository.findAll(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Page<Question> findWithCriteria(Pageable page, Integer scientifiqueId) {
|
|
|
|
|
|
|
|
return questionRepository.findAllQuestionsByScientifiqueId(page, scientifiqueId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|