Changeset 4b1c93d


Ignore:
Timestamp:
01/08/21 15:05:58 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
277b400
Parents:
336d09e
Message:

added response types to team and company

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

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/model/dto/CompanyResponseDTO.java

    r336d09e r4b1c93d  
    1111public class CompanyResponseDTO extends LoginResponseDTO {
    1212    private Address address;
    13     private List<Job> jobs;
    14     private List<Internship> internships;
     13    private List<JobResponseDTO> jobs;
     14    private List<InternshipResponseDTO> internships;
    1515}
  • src/main/java/it/finki/tinki/model/dto/TeamResponseDTO.java

    r336d09e r4b1c93d  
    11package it.finki.tinki.model.dto;
    22
    3 import it.finki.tinki.model.Jobs.Job;
    4 import it.finki.tinki.model.Jobs.Project;
    53import lombok.Data;
    64
     
    108public class TeamResponseDTO extends LoginResponseDTO{
    119    private int members;
    12     private List<Job> jobs;
    13     private List<Project> projects;
     10    private List<JobResponseDTO> jobs;
     11    private List<ProjectResponseDTO> projects;
    1412}
  • src/main/java/it/finki/tinki/web/controller/LoginController.java

    r336d09e r4b1c93d  
    3232        this.workService = workService;
    3333    }
    34 
    35     //TODO: ADD JOB/INTERNSHIP RESPONSE TYPE TO COMPANY AND TEAM ---------------------v
    3634
    3735    @PostMapping(path = "/login")
     
    9088                tDto.setMembers(((Team) a1).getMembers());
    9189
    92                 tDto.setJobs(this.workService.getAllJobsByAccount(a1.getId()));
    93                 tDto.setProjects(this.workService.getAllProjectsByAccount(a1.getId()));
     90                List<Job> jobs = this.workService.getAllJobsByAccount(a1.getId());
     91                List<Project> projects = this.workService.getAllProjectsByAccount(a1.getId());
     92
     93                jobs.forEach(job -> {
     94                    JobResponseDTO dto = new JobResponseDTO(job);
     95                    tDto.getJobs().add(dto);
     96                });
     97
     98                projects.forEach(project -> {
     99                    ProjectResponseDTO dto = new ProjectResponseDTO(project);
     100                    tDto.getProjects().add(dto);
     101                });
    94102
    95103                return tDto;
     
    107115                cDto.setAddress(((Company) a1).getAddress());
    108116
    109                 cDto.setJobs(this.workService.getAllJobsByAccount(a1.getId()));
    110                 cDto.setInternships(this.workService.getAllInternshipsByAccount(a1.getId()));
     117                List<Job> jobs = this.workService.getAllJobsByAccount(a1.getId());
     118                List<Internship> internships = this.workService.getAllInternshipsByAccount(a1.getId());
     119
     120                jobs.forEach(job -> {
     121                    JobResponseDTO dto = new JobResponseDTO(job);
     122                    cDto.getJobs().add(dto);
     123                });
     124
     125                internships.forEach(internship -> {
     126                    InternshipResponseDTO dto = new InternshipResponseDTO(internship);
     127                    cDto.getInternships().add(dto);
     128                });
    111129
    112130                return cDto;
Note: See TracChangeset for help on using the changeset viewer.