package es.uv.garcosda.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import es.uv.garcosda.domain.Document;
import es.uv.garcosda.repositories.NewsRepository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Service
@Transactional
public class NewsService {

	@Autowired
	NewsRepository nr;
	
	public Mono<Document> findById(Integer id){
		return this.nr.findById(id);
	}
	
	public Mono<Document> update(Document n){
		return this.nr.save(n);
	}
	
	public Mono<Document> insert(Document n) {
		return this.nr.save(n);
	}
	
	public Flux<Document> createAll(List<Document> ns){
		return this.nr.saveAll(ns);
	}
	
	public Mono<Void> deleteById(Integer id) {
		return this.nr.deleteById(id);
	}
}
