source: src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java@ 723994f

Last change on this file since 723994f was 723994f, checked in by Vzdra <vladko.zdravkovski@…>, 3 years ago

refactoring and further login functionality

  • Property mode set to 100644
File size: 1.9 KB
Line 
1package it.finki.tinki.service.impl;
2
3import it.finki.tinki.model.Jobs.Internship;
4import it.finki.tinki.model.Jobs.Job;
5import it.finki.tinki.model.Jobs.Project;
6import it.finki.tinki.model.Match;
7import it.finki.tinki.model.Users.Team;
8import it.finki.tinki.model.Users.User;
9import it.finki.tinki.model.enumerator.WorkType;
10import it.finki.tinki.repository.MatchRepository;
11import it.finki.tinki.service.MatchmakerService;
12import org.springframework.stereotype.Service;
13
14import java.util.ArrayList;
15import java.util.List;
16
17
18@Service
19public class MatchmakerServiceImpl implements MatchmakerService {
20
21 MatchRepository matchRepository;
22
23 public MatchmakerServiceImpl(MatchRepository matchRepository) {
24 this.matchRepository = matchRepository;
25 }
26
27 @Override
28 public List<Internship> getMatchingInternshipsForUser(User user) {
29 List<Match> matches = this.matchRepository.getAllByCombinedId_UserAndTypeOrderByCoefficientDesc(user, WorkType.INTERNSHIP);
30
31 List<Internship> internships = new ArrayList<>();
32 matches.forEach(match -> {
33 internships.add((Internship) match.getCombinedId().getWork());
34 });
35
36 return internships;
37 }
38
39 @Override
40 public List<Job> getMatchingJobsForUser(User user) {
41 List<Match> matches = this.matchRepository.getAllByCombinedId_UserAndTypeOrderByCoefficientDesc(user, WorkType.JOB);
42
43 List<Job> jobs = new ArrayList<>();
44 matches.forEach(match -> {
45 jobs.add((Job) match.getCombinedId().getWork());
46 });
47
48 return jobs;
49 }
50
51 @Override
52 public List<Project> getMatchingProjectsForUser(User user) {
53 List<Match> matches = this.matchRepository.getAllByCombinedId_UserAndTypeOrderByCoefficientDesc(user, WorkType.PROJECT);
54
55 List<Project> projects = new ArrayList<>();
56 matches.forEach(match -> {
57 projects.add((Project) match.getCombinedId().getWork());
58 });
59
60 return projects;
61 }
62}
Note: See TracBrowser for help on using the repository browser.