Ignore:
Timestamp:
01/09/21 01:07:09 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
f067338
Parents:
bd46dbb
Message:

added job/internship/project inserts

Location:
src/main/java/it/finki/tinki/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/service/AccountService.java

    rbd46dbb r297bd16  
    1919    User editUser(Long id, String email, String name, String surname, List<Skill> retainedSkills, List<Skill> skillsToLearn);
    2020    Company editCompany(Long id, String email, String name, String country, String city, String street);
     21    Team editTeam(Long id, String email, String name, int members);
    2122    Optional<?> findByIdAndEmail(Long id, String email, AccountType type);
    22     Team editTeam(Long id, String email, String name, int members);
    2323}
  • src/main/java/it/finki/tinki/service/impl/WorkServiceImpl.java

    rbd46dbb r297bd16  
    11package it.finki.tinki.service.impl;
    22
     3import it.finki.tinki.model.Users.User;
    34import it.finki.tinki.model.Work.Internship;
    45import it.finki.tinki.model.Work.Job;
     
    78import it.finki.tinki.model.Users.Account;
    89import it.finki.tinki.model.enumerator.AccountType;
    9 import it.finki.tinki.repository.InternshipRepository;
    10 import it.finki.tinki.repository.JobRepository;
    11 import it.finki.tinki.repository.MatchRepository;
    12 import it.finki.tinki.repository.ProjectRepository;
     10import it.finki.tinki.repository.*;
    1311import it.finki.tinki.service.AccountService;
     12import it.finki.tinki.service.MatchmakerService;
    1413import it.finki.tinki.service.SkillService;
    1514import it.finki.tinki.service.WorkService;
     
    2625    ProjectRepository projectRepository;
    2726    MatchRepository matchRepository;
     27    MatchmakerService matchmakerService;
    2828    SkillService skillService;
    2929    AccountService accountService;
     30    UserRepository userRepository;
    3031
    3132    public WorkServiceImpl(JobRepository jobRepository,
     
    3435                           MatchRepository matchRepository,
    3536                           SkillService skillService,
    36                            AccountService accountService) {
     37                           AccountService accountService,
     38                           UserRepository userRepository,
     39                           MatchmakerService matchmakerService) {
    3740        this.jobRepository = jobRepository;
    3841        this.internshipRepository = internshipRepository;
     
    4144        this.skillService = skillService;
    4245        this.accountService = accountService;
     46        this.userRepository = userRepository;
     47        this.matchmakerService = matchmakerService;
    4348    }
    4449
     
    7883        Account account = this.accountService.findByIdAndType(adccId, type);
    7984        Job j = new Job(title, description, account, salary, skills);
    80         return this.jobRepository.save(j);
     85        Job jb = this.jobRepository.save(j);
     86
     87        List<User> users = this.userRepository.findAll();
     88
     89        users.forEach(user -> {
     90            this.matchmakerService.setUpUserJobMatches(jb, user);
     91        });
     92
     93        return jb;
    8194    }
    8295
     
    8699        Account account = this.accountService.findByIdAndType(adccId, type);
    87100        Internship j = new Internship(title, description, account, salary, skills, openSpots);
    88         return this.internshipRepository.save(j);
     101        Internship jb = this.internshipRepository.save(j);
     102
     103        List<User> users = this.userRepository.findAll();
     104
     105        users.forEach(user -> {
     106            this.matchmakerService.setUpUserInternshipMatches(jb, user);
     107        });
     108
     109        return jb;
    89110    }
    90111
     
    94115        Account account = this.accountService.findByIdAndType(adccId, type);
    95116        Project j = new Project(title, description, account, salary, skills, validUntil);
    96         return this.projectRepository.save(j);
     117        Project jb = this.projectRepository.save(j);
     118
     119        List<User> users = this.userRepository.findAll();
     120
     121        users.forEach(user -> {
     122            this.matchmakerService.setUpUserProjectMatches(jb, user);
     123        });
     124
     125        return jb;
    97126    }
    98127}
Note: See TracChangeset for help on using the changeset viewer.