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

Last change on this file since fc8421e was 17abe5e, checked in by i-ina <76742075+i-ina@…>, 3 years ago

react components for details and bugfix

  • Property mode set to 100644
File size: 2.0 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@CrossOrigin(origins = "http://localhost:3000")
17@RequestMapping(path = "/api/register/work")
18public 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}
Note: See TracBrowser for help on using the repository browser.