1 | package it.finki.tinki.web.controller;
|
---|
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;
|
---|
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;
|
---|
13 | import org.springframework.web.bind.annotation.PostMapping;
|
---|
14 | import org.springframework.web.bind.annotation.RequestBody;
|
---|
15 | import org.springframework.web.bind.annotation.RequestMapping;
|
---|
16 | import org.springframework.web.bind.annotation.RestController;
|
---|
17 |
|
---|
18 | @RestController
|
---|
19 | @RequestMapping(path = "/api/register/work")
|
---|
20 | public class WorkRegisterController {
|
---|
21 |
|
---|
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 | }
|
---|
54 | }
|
---|