[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 |
|
---|
[bd46dbb] | 15 | @RestController
|
---|
[17abe5e] | 16 | @CrossOrigin(origins = "http://localhost:3000")
|
---|
[bd46dbb] | 17 | @RequestMapping(path = "/api/register/work")
|
---|
| 18 | public class WorkRegisterController {
|
---|
| 19 |
|
---|
[297bd16] | 20 | WorkService workService;
|
---|
| 21 |
|
---|
| 22 | public WorkRegisterController(WorkService workService) {
|
---|
| 23 | this.workService = workService;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | @PostMapping("/job")
|
---|
| 27 | 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);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @PostMapping("/internship")
|
---|
| 34 | 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);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | @PostMapping("/project")
|
---|
| 41 | 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);
|
---|
| 45 | }
|
---|
[bd46dbb] | 46 | }
|
---|