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.*;
|
---|
14 |
|
---|
15 | @RestController
|
---|
16 | @CrossOrigin(origins = "http://localhost:3000")
|
---|
17 | @RequestMapping(path = "/api/register/work")
|
---|
18 | public class WorkRegisterController {
|
---|
19 |
|
---|
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 |
|
---|
29 | Job j = this.workService.insertJob(body.getTitle(),
|
---|
30 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType());
|
---|
31 |
|
---|
32 | return new JobResponseDTO(j);
|
---|
33 | }
|
---|
34 |
|
---|
35 | @PostMapping("/internship")
|
---|
36 | public InternshipResponseDTO registerInternship(@RequestBody InternshipRegisterDTO body){
|
---|
37 |
|
---|
38 | Internship j = this.workService.insertInternship(body.getTitle(),
|
---|
39 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType());
|
---|
40 |
|
---|
41 | return new InternshipResponseDTO(j);
|
---|
42 | }
|
---|
43 |
|
---|
44 | @PostMapping("/project")
|
---|
45 | public ProjectResponseDTO registerProject(@RequestBody ProjectRegisterDTO body){
|
---|
46 |
|
---|
47 | Project j = this.workService.insertProject(body.getTitle(),
|
---|
48 | body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType());
|
---|
49 |
|
---|
50 | return new ProjectResponseDTO(j);
|
---|
51 | }
|
---|
52 | }
|
---|