Ignore:
Timestamp:
01/09/21 03:40:07 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
17abe5e
Parents:
f067338
Message:

added work edit routes

Location:
src/main/java/it/finki/tinki
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/service/WorkService.java

    rf067338 ra3d2b0d  
    1717    List<Internship> getAllInternshipsByAccount(Long accId);
    1818    List<Project> getAllProjectsByAccount(Long accId);
    19     List<Job> getAllJobs();
    20     List<Internship> getAllInternships();
    21     List<Project> getAllProjects();
    2219    Job insertJob(String title, String description, Long accId, int salary, List<Long> skillsRequired, AccountType type);
    2320    Internship insertInternship(String title, String description, Long adccId, int salary, List<Long> skillsTrained, int openSpots, AccountType type);
    2421    Project insertProject(String title, String description, Long adccId, int salary, List<Long> skillsRequired, Date validUntil, AccountType type);
     22    Job editJob(Long id, String title, String description, int salary);
     23    Internship editInternship(Long id, String title, String description, int salary, int openSpots);
     24    Project editProject(Long id, String title, String description, int salary);
    2525    List<JobResponseDTO> fullTextJobSearch(String text);
    2626    List<InternshipResponseDTO> fullTextInternshipSearch(String text);
    2727    List<ProjectResponseDTO> fullTextProjectSearch(String text);
     28    Job getJobById(Long id);
     29    Internship getInternshipById(Long id);
     30    Project getProjectById(Long id);
    2831}
  • src/main/java/it/finki/tinki/service/impl/WorkServiceImpl.java

    rf067338 ra3d2b0d  
    6868
    6969    @Override
    70     public List<Job> getAllJobs() {
    71         return this.jobRepository.findAll();
    72     }
    73 
    74     @Override
    75     public List<Internship> getAllInternships() {
    76         return this.internshipRepository.findAll();
    77     }
    78 
    79     @Override
    80     public List<Project> getAllProjects() {
    81         return this.projectRepository.findAll();
    82     }
    83 
    84     @Override
    8570    public Job insertJob(String title, String description, Long adccId, int salary, List<Long> skillsRequired, AccountType type) {
    8671        List<Skill> skills = this.skillService.returnSkillsBasedOnId(skillsRequired);
     
    131116
    132117    @Override
     118    public Job editJob(Long id, String title, String description, int salary) {
     119        Job j = this.jobRepository.findById(id).get();
     120
     121        j.setTitle(title);
     122        j.setDescription(description);
     123        j.setSalary(salary);
     124
     125        return this.jobRepository.save(j);
     126    }
     127
     128    @Override
     129    public Internship editInternship(Long id, String title, String description, int salary, int openSpots) {
     130        Internship j = this.internshipRepository.findById(id).get();
     131
     132        j.setTitle(title);
     133        j.setDescription(description);
     134        j.setSalary(salary);
     135
     136        return this.internshipRepository.save(j);
     137    }
     138
     139    @Override
     140    public Project editProject(Long id, String title, String description, int salary) {
     141        Project j = this.projectRepository.findById(id).get();
     142
     143        j.setTitle(title);
     144        j.setDescription(description);
     145        j.setSalary(salary);
     146
     147        return this.projectRepository.save(j);
     148    }
     149
     150    @Override
    133151    public List<JobResponseDTO> fullTextJobSearch(String text) {
    134152        List<Skill> skills = this.skillService.returnBasedOnText(text);
     
    207225        return jobs2;
    208226    }
     227
     228    @Override
     229    public Job getJobById(Long id) {
     230        return this.jobRepository.findById(id).get();
     231    }
     232
     233    @Override
     234    public Internship getInternshipById(Long id) {
     235        return this.internshipRepository.findById(id).get();
     236    }
     237
     238    @Override
     239    public Project getProjectById(Long id) {
     240        return this.projectRepository.findById(id).get();
     241    }
    209242}
  • src/main/java/it/finki/tinki/web/controller/WorkRegisterController.java

    rf067338 ra3d2b0d  
    1212import it.finki.tinki.service.WorkService;
    1313import org.springframework.web.bind.annotation.*;
    14 
    15 import java.util.List;
    1614
    1715@RestController
Note: See TracChangeset for help on using the changeset viewer.