Ignore:
Timestamp:
01/09/21 01:07:09 (3 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
f067338
Parents:
bd46dbb
Message:

added job/internship/project inserts

Location:
src/main/java/it/finki/tinki/web/controller
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/web/controller/AccountRegisterController.java

    rbd46dbb r297bd16  
    1919@CrossOrigin(origins = "http://localhost:3000")
    2020@RequestMapping("/api/register")
    21 public class RegisterController {
     21public class AccountRegisterController {
    2222
    2323    AccountService accountService;
     
    2626    MatchmakerService matchmakerService;
    2727
    28     public RegisterController(AccountService accountService, SkillService skillService, WorkService workService, MatchmakerService matchmakerService) {
     28    public AccountRegisterController(AccountService accountService, SkillService skillService, WorkService workService, MatchmakerService matchmakerService) {
    2929        this.accountService = accountService;
    3030        this.skillService = skillService;
  • src/main/java/it/finki/tinki/web/controller/WorkRegisterController.java

    rbd46dbb r297bd16  
    11package it.finki.tinki.web.controller;
    22
     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;
    310import it.finki.tinki.model.dto.response.work.JobResponseDTO;
     11import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
     12import it.finki.tinki.service.WorkService;
    413import org.springframework.web.bind.annotation.PostMapping;
    514import org.springframework.web.bind.annotation.RequestBody;
     
    1120public class WorkRegisterController {
    1221
    13 //    @PostMapping("/job")
    14 //    public JobResponseDTO registerJob(@RequestBody JobRegisterDTO body){
    15 //
    16 //    }
     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    }
    1754}
Note: See TracChangeset for help on using the changeset viewer.