- Timestamp:
- 01/12/21 02:42:18 (3 years ago)
- Branches:
- master
- Children:
- a70db1a
- Parents:
- 8f1f460
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/web/controller/WorkRegisterController.java
r8f1f460 r33d4f5d 1 1 package it.finki.tinki.web.controller; 2 2 3 import it.finki.tinki.model.Users.Account; 3 4 import it.finki.tinki.model.Work.Internship; 4 5 import it.finki.tinki.model.Work.Job; … … 10 11 import it.finki.tinki.model.dto.response.work.JobResponseDTO; 11 12 import it.finki.tinki.model.dto.response.work.ProjectResponseDTO; 13 import it.finki.tinki.model.enumerator.AccountType; 12 14 import it.finki.tinki.service.WorkService; 13 15 import org.springframework.web.bind.annotation.*; … … 26 28 @PostMapping("/job") 27 29 public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){ 28 Job j = this.workService.insertJob(body.getTitle(), 29 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType()); 30 return new JobResponseDTO(j); 30 31 if(body.getType() != AccountType.USER){ 32 Job j = this.workService.insertJob(body.getTitle(), 33 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType()); 34 return new JobResponseDTO(j); 35 } 36 37 return new JobResponseDTO(); 31 38 } 32 39 33 40 @PostMapping("/internship") 34 41 public InternshipResponseDTO registerInternship(@RequestBody InternshipRegisterDTO body){ 35 Internship j = this.workService.insertInternship(body.getTitle(), 36 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType()); 37 return new InternshipResponseDTO(j); 42 if(body.getType() == AccountType.COMPANY){ 43 Internship j = this.workService.insertInternship(body.getTitle(), 44 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType()); 45 return new InternshipResponseDTO(j); 46 } 47 48 return new InternshipResponseDTO(); 38 49 } 39 50 40 51 @PostMapping("/project") 41 52 public ProjectResponseDTO registerProject(@RequestBody ProjectRegisterDTO body){ 42 Project j = this.workService.insertProject(body.getTitle(), 43 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType()); 44 return new ProjectResponseDTO(j); 53 54 if(body.getType() == AccountType.TEAM){ 55 Project j = this.workService.insertProject(body.getTitle(), 56 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType()); 57 return new ProjectResponseDTO(j); 58 } 59 60 return new ProjectResponseDTO(); 45 61 } 46 62 }
Note:
See TracChangeset
for help on using the changeset viewer.