Ignore:
Timestamp:
01/12/21 02:42:18 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
a70db1a
Parents:
8f1f460
Message:

bugfixes and refactoring

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

Legend:

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

    r8f1f460 r33d4f5d  
    11package it.finki.tinki.service;
    22
     3import it.finki.tinki.model.Match;
    34import it.finki.tinki.model.Work.Internship;
    45import it.finki.tinki.model.Work.Job;
     
    1516    void setUpUserProjectMatches(Project project, User user);
    1617    void setUpUserInternshipMatches(Internship internship, User user);
     18    List<Match> removeByUserId(Long userId);
    1719}
  • src/main/java/it/finki/tinki/service/impl/AccountServiceImpl.java

    r8f1f460 r33d4f5d  
    214214
    215215    private void setUpUser(User u){
     216
     217        this.matchmakerService.removeByUserId(u.getId());
     218
    216219        List<Job> jobs = this.jobRepository.findAll();
    217220        List<Project> projects = this.projectRepository.findAll();
  • src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java

    r8f1f460 r33d4f5d  
    1717import org.springframework.stereotype.Service;
    1818
     19import javax.transaction.Transactional;
    1920import java.util.ArrayList;
    2021import java.util.List;
     
    118119        if(coef!=0){
    119120            EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(internship, user);
    120             Match m = new Match(embeddedMatchId, coef, WorkType.PROJECT);
     121            Match m = new Match(embeddedMatchId, coef, WorkType.INTERNSHIP);
    121122            this.matchRepository.save(m);
    122123        }
    123124    }
    124125
     126    @Transactional
     127    @Override
     128    public List<Match> removeByUserId(Long userId) {
     129        return this.matchRepository.deleteAllByEmbeddedMatchId_User_Id(userId);
     130    }
    125131
    126132}
Note: See TracChangeset for help on using the changeset viewer.