1 | package mk.ukim.finki.eglas.services.Impl;
|
---|
2 |
|
---|
3 | import mk.ukim.finki.eglas.model.CandidatesListVote;
|
---|
4 | import mk.ukim.finki.eglas.repository.CandidatesListVoteRepository;
|
---|
5 | import mk.ukim.finki.eglas.services.CandidatesListService;
|
---|
6 | import mk.ukim.finki.eglas.services.CandidatesListVoteService;
|
---|
7 | import mk.ukim.finki.eglas.services.TurnoutService;
|
---|
8 | import org.springframework.stereotype.Service;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 | @Service
|
---|
12 | public class CandidatesListVoteServiceImpl implements CandidatesListVoteService{
|
---|
13 |
|
---|
14 | private final CandidatesListVoteRepository repository;
|
---|
15 | private final TurnoutService turnoutService;
|
---|
16 | private final CandidatesListService candidatesListService;
|
---|
17 |
|
---|
18 | public CandidatesListVoteServiceImpl(CandidatesListVoteRepository repository,
|
---|
19 | TurnoutService turnoutService,
|
---|
20 | CandidatesListService candidatesListService){
|
---|
21 | this.repository = repository;
|
---|
22 | this.turnoutService = turnoutService;
|
---|
23 | this.candidatesListService = candidatesListService;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public CandidatesListVote findById(Long id){
|
---|
27 | return repository.findById(id).orElseThrow(() -> new RuntimeException("no candidate list vote found"));
|
---|
28 | }
|
---|
29 |
|
---|
30 | public List<CandidatesListVote> findAll(){
|
---|
31 | return repository.findAll();
|
---|
32 | }
|
---|
33 |
|
---|
34 | public CandidatesListVote update(Long id, Long CandidateListId){
|
---|
35 | // CandidatesListVote clv = (CandidatesListVote) voteService.findById(id);
|
---|
36 | // clv.setCandidatesList(candidatesListService.findById(id));
|
---|
37 | // return repository.save(clv);
|
---|
38 | return null;
|
---|
39 | }
|
---|
40 |
|
---|
41 | public void delete(Long id){
|
---|
42 | repository.delete(findById(id));
|
---|
43 | };
|
---|
44 | }
|
---|