source: src/main/java/it/finki/tinki/model/dto/JobResponseDTO.java@ 4cec0a3

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

added response dto for job response

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package it.finki.tinki.model.dto;
2
3import it.finki.tinki.model.Address;
4import it.finki.tinki.model.Jobs.Job;
5import it.finki.tinki.model.Users.Company;
6import it.finki.tinki.model.Users.Team;
7import it.finki.tinki.model.enumerator.AccountType;
8import lombok.Data;
9
10@Data
11public class JobResponseDTO {
12 Long id;
13 String title;
14 String description;
15 int salary;
16 String accountEmail;
17 String accountName;
18 AccountType accountType;
19 Address accountAddress;
20 int members;
21
22 public JobResponseDTO(Job job){
23 this.id = job.getId();
24 this.title = job.getTitle();
25 this.description = job.getDescription();
26 this.salary = job.getSalary();
27 this.accountEmail = job.getAccount().getEmail();
28 this.accountName = job.getAccount().getName();
29 this.accountType = job.getAccount().getAccountType();
30 if(job.getAccount().getAccountType()==AccountType.COMPANY){
31 this.accountAddress = ((Company) job.getAccount()).getAddress();
32 this.members = 0;
33 }else{
34 this.members = ((Team) job.getAccount()).getMembers();
35 this.accountAddress = null;
36 }
37 }
38}
Note: See TracBrowser for help on using the repository browser.