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

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

added full text search on work

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