source: src/main/java/it/finki/tinki/web/controller/WorkRegisterController.java@ 297bd16

Last change on this file since 297bd16 was 297bd16, checked in by Vzdra <vladko.zdravkovski@…>, 3 years ago

added job/internship/project inserts

  • Property mode set to 100644
File size: 2.1 KB
Line 
1package it.finki.tinki.web.controller;
2
3import it.finki.tinki.model.Work.Internship;
4import it.finki.tinki.model.Work.Job;
5import it.finki.tinki.model.Work.Project;
6import it.finki.tinki.model.dto.register.work.InternshipRegisterDTO;
7import it.finki.tinki.model.dto.register.work.JobRegisterDTO;
8import it.finki.tinki.model.dto.register.work.ProjectRegisterDTO;
9import it.finki.tinki.model.dto.response.work.InternshipResponseDTO;
10import it.finki.tinki.model.dto.response.work.JobResponseDTO;
11import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
12import it.finki.tinki.service.WorkService;
13import org.springframework.web.bind.annotation.PostMapping;
14import org.springframework.web.bind.annotation.RequestBody;
15import org.springframework.web.bind.annotation.RequestMapping;
16import org.springframework.web.bind.annotation.RestController;
17
18@RestController
19@RequestMapping(path = "/api/register/work")
20public 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}
Note: See TracBrowser for help on using the repository browser.