Changeset 297bd16 for src/main/java/it/finki
- Timestamp:
- 01/09/21 01:07:09 (4 years ago)
- Branches:
- master
- Children:
- f067338
- Parents:
- bd46dbb
- Location:
- src/main/java/it/finki/tinki
- Files:
-
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/TinkiApplication.java
rbd46dbb r297bd16 11 11 SpringApplication.run(TinkiApplication.class, args); 12 12 } 13 13 14 } -
src/main/java/it/finki/tinki/model/EmbeddedMatchId.java
rbd46dbb r297bd16 19 19 private User user; 20 20 21 public EmbeddedMatchId(){ 21 public EmbeddedMatchId(){} 22 22 23 23 public EmbeddedMatchId(Work work, User user){ -
src/main/java/it/finki/tinki/model/dto/register/work/InternshipRegisterDTO.java
rbd46dbb r297bd16 6 6 7 7 @Data 8 public class InternshipRegisterDTO {8 public class InternshipRegisterDTO extends WorkRegisterDTO { 9 9 int openSpots; 10 10 List<Long> skillsTrained; -
src/main/java/it/finki/tinki/model/dto/register/work/ProjectRegisterDTO.java
rbd46dbb r297bd16 7 7 8 8 @Data 9 public class ProjectRegisterDTO {9 public class ProjectRegisterDTO extends WorkRegisterDTO { 10 10 Date validUntil; 11 11 List<Long> skillsRequired; -
src/main/java/it/finki/tinki/model/dto/register/work/WorkRegisterDTO.java
rbd46dbb r297bd16 1 1 package it.finki.tinki.model.dto.register.work; 2 2 3 import it.finki.tinki.model.enumerator.AccountType; 3 4 import lombok.Data; 4 5 … … 9 10 Long accountId; 10 11 int salary; 12 AccountType type; 11 13 } -
src/main/java/it/finki/tinki/service/AccountService.java
rbd46dbb r297bd16 19 19 User editUser(Long id, String email, String name, String surname, List<Skill> retainedSkills, List<Skill> skillsToLearn); 20 20 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); 21 22 Optional<?> findByIdAndEmail(Long id, String email, AccountType type); 22 Team editTeam(Long id, String email, String name, int members);23 23 } -
src/main/java/it/finki/tinki/service/impl/WorkServiceImpl.java
rbd46dbb r297bd16 1 1 package it.finki.tinki.service.impl; 2 2 3 import it.finki.tinki.model.Users.User; 3 4 import it.finki.tinki.model.Work.Internship; 4 5 import it.finki.tinki.model.Work.Job; … … 7 8 import it.finki.tinki.model.Users.Account; 8 9 import 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; 10 import it.finki.tinki.repository.*; 13 11 import it.finki.tinki.service.AccountService; 12 import it.finki.tinki.service.MatchmakerService; 14 13 import it.finki.tinki.service.SkillService; 15 14 import it.finki.tinki.service.WorkService; … … 26 25 ProjectRepository projectRepository; 27 26 MatchRepository matchRepository; 27 MatchmakerService matchmakerService; 28 28 SkillService skillService; 29 29 AccountService accountService; 30 UserRepository userRepository; 30 31 31 32 public WorkServiceImpl(JobRepository jobRepository, … … 34 35 MatchRepository matchRepository, 35 36 SkillService skillService, 36 AccountService accountService) { 37 AccountService accountService, 38 UserRepository userRepository, 39 MatchmakerService matchmakerService) { 37 40 this.jobRepository = jobRepository; 38 41 this.internshipRepository = internshipRepository; … … 41 44 this.skillService = skillService; 42 45 this.accountService = accountService; 46 this.userRepository = userRepository; 47 this.matchmakerService = matchmakerService; 43 48 } 44 49 … … 78 83 Account account = this.accountService.findByIdAndType(adccId, type); 79 84 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; 81 94 } 82 95 … … 86 99 Account account = this.accountService.findByIdAndType(adccId, type); 87 100 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; 89 110 } 90 111 … … 94 115 Account account = this.accountService.findByIdAndType(adccId, type); 95 116 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; 97 126 } 98 127 } -
src/main/java/it/finki/tinki/web/controller/AccountRegisterController.java
rbd46dbb r297bd16 19 19 @CrossOrigin(origins = "http://localhost:3000") 20 20 @RequestMapping("/api/register") 21 public class RegisterController {21 public class AccountRegisterController { 22 22 23 23 AccountService accountService; … … 26 26 MatchmakerService matchmakerService; 27 27 28 public RegisterController(AccountService accountService, SkillService skillService, WorkService workService, MatchmakerService matchmakerService) {28 public AccountRegisterController(AccountService accountService, SkillService skillService, WorkService workService, MatchmakerService matchmakerService) { 29 29 this.accountService = accountService; 30 30 this.skillService = skillService; -
src/main/java/it/finki/tinki/web/controller/WorkRegisterController.java
rbd46dbb r297bd16 1 1 package it.finki.tinki.web.controller; 2 2 3 import it.finki.tinki.model.Work.Internship; 4 import it.finki.tinki.model.Work.Job; 5 import it.finki.tinki.model.Work.Project; 6 import it.finki.tinki.model.dto.register.work.InternshipRegisterDTO; 7 import it.finki.tinki.model.dto.register.work.JobRegisterDTO; 8 import it.finki.tinki.model.dto.register.work.ProjectRegisterDTO; 9 import it.finki.tinki.model.dto.response.work.InternshipResponseDTO; 3 10 import it.finki.tinki.model.dto.response.work.JobResponseDTO; 11 import it.finki.tinki.model.dto.response.work.ProjectResponseDTO; 12 import it.finki.tinki.service.WorkService; 4 13 import org.springframework.web.bind.annotation.PostMapping; 5 14 import org.springframework.web.bind.annotation.RequestBody; … … 11 20 public class WorkRegisterController { 12 21 13 // @PostMapping("/job") 14 // public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){ 15 // 16 // } 22 WorkService workService; 23 24 public WorkRegisterController(WorkService workService) { 25 this.workService = workService; 26 } 27 28 @PostMapping("/job") 29 public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){ 30 31 Job j = this.workService.insertJob(body.getTitle(), 32 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType()); 33 34 return new JobResponseDTO(j); 35 } 36 37 @PostMapping("/internship") 38 public InternshipResponseDTO registerInternship(@RequestBody InternshipRegisterDTO body){ 39 40 Internship j = this.workService.insertInternship(body.getTitle(), 41 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType()); 42 43 return new InternshipResponseDTO(j); 44 } 45 46 @PostMapping("/project") 47 public ProjectResponseDTO registerProject(@RequestBody ProjectRegisterDTO body){ 48 49 Project j = this.workService.insertProject(body.getTitle(), 50 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType()); 51 52 return new ProjectResponseDTO(j); 53 } 17 54 }
Note:
See TracChangeset
for help on using the changeset viewer.