[bd46dbb] | 1 | package it.finki.tinki.web.controller;
|
---|
| 2 |
|
---|
[297bd16] | 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;
|
---|
[bd46dbb] | 10 | import it.finki.tinki.model.dto.response.work.JobResponseDTO;
|
---|
[297bd16] | 11 | import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
|
---|
| 12 | import it.finki.tinki.service.WorkService;
|
---|
[f067338] | 13 | import org.springframework.web.bind.annotation.*;
|
---|
| 14 |
|
---|
| 15 | import java.util.List;
|
---|
[bd46dbb] | 16 |
|
---|
| 17 | @RestController
|
---|
| 18 | @RequestMapping(path = "/api/register/work")
|
---|
| 19 | public class WorkRegisterController {
|
---|
| 20 |
|
---|
[297bd16] | 21 | WorkService workService;
|
---|
| 22 |
|
---|
| 23 | public WorkRegisterController(WorkService workService) {
|
---|
| 24 | this.workService = workService;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | @PostMapping("/job")
|
---|
| 28 | public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){
|
---|
| 29 |
|
---|
| 30 | Job j = this.workService.insertJob(body.getTitle(),
|
---|
| 31 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType());
|
---|
| 32 |
|
---|
| 33 | return new JobResponseDTO(j);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | @PostMapping("/internship")
|
---|
| 37 | public InternshipResponseDTO registerInternship(@RequestBody InternshipRegisterDTO body){
|
---|
| 38 |
|
---|
| 39 | Internship j = this.workService.insertInternship(body.getTitle(),
|
---|
| 40 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType());
|
---|
| 41 |
|
---|
| 42 | return new InternshipResponseDTO(j);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | @PostMapping("/project")
|
---|
| 46 | public ProjectResponseDTO registerProject(@RequestBody ProjectRegisterDTO body){
|
---|
| 47 |
|
---|
| 48 | Project j = this.workService.insertProject(body.getTitle(),
|
---|
| 49 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType());
|
---|
| 50 |
|
---|
| 51 | return new ProjectResponseDTO(j);
|
---|
| 52 | }
|
---|
[bd46dbb] | 53 | }
|
---|