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

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

added work edit routes

  • Property mode set to 100644
File size: 1.9 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.*;
14
15@RestController
16@RequestMapping(path = "/api/register/work")
17public class WorkRegisterController {
18
19 WorkService workService;
20
21 public WorkRegisterController(WorkService workService) {
22 this.workService = workService;
23 }
24
25 @PostMapping("/job")
26 public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){
27
28 Job j = this.workService.insertJob(body.getTitle(),
29 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getType());
30
31 return new JobResponseDTO(j);
32 }
33
34 @PostMapping("/internship")
35 public InternshipResponseDTO registerInternship(@RequestBody InternshipRegisterDTO body){
36
37 Internship j = this.workService.insertInternship(body.getTitle(),
38 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsTrained(), body.getOpenSpots(), body.getType());
39
40 return new InternshipResponseDTO(j);
41 }
42
43 @PostMapping("/project")
44 public ProjectResponseDTO registerProject(@RequestBody ProjectRegisterDTO body){
45
46 Project j = this.workService.insertProject(body.getTitle(),
47 body.getDescription(), body.getAccountId(), body.getSalary(), body.getSkillsRequired(), body.getValidUntil(), body.getType());
48
49 return new ProjectResponseDTO(j);
50 }
51}
Note: See TracBrowser for help on using the repository browser.