Changeset bd46dbb


Ignore:
Timestamp:
01/08/21 23:47:41 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
297bd16
Parents:
bd38a55
Message:

refactoring and response dto

Location:
src/main/java/it/finki/tinki
Files:
10 added
5 deleted
14 edited
11 moved

Legend:

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

    rbd38a55 rbd46dbb  
    33import org.springframework.boot.SpringApplication;
    44import org.springframework.boot.autoconfigure.SpringBootApplication;
     5import org.springframework.context.annotation.Bean;
    56
    67@SpringBootApplication
     
    1011        SpringApplication.run(TinkiApplication.class, args);
    1112    }
    12 
    1313}
  • src/main/java/it/finki/tinki/bootstrap/DataHolder.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.bootstrap;
    22
    3 import it.finki.tinki.model.Jobs.Job;
     3import it.finki.tinki.model.Work.Job;
    44import it.finki.tinki.model.Skill;
    55import it.finki.tinki.model.Users.Account;
  • src/main/java/it/finki/tinki/model/EmbeddedMatchId.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.model;
    22
    3 import it.finki.tinki.model.Jobs.Work;
     3import it.finki.tinki.model.Work.Work;
    44import it.finki.tinki.model.Users.User;
    55import lombok.Data;
  • src/main/java/it/finki/tinki/model/Work/Internship.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.Jobs;
     1package it.finki.tinki.model.Work;
    22
    33import it.finki.tinki.model.Skill;
  • src/main/java/it/finki/tinki/model/Work/Job.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.Jobs;
     1package it.finki.tinki.model.Work;
    22
    33import it.finki.tinki.model.Skill;
  • src/main/java/it/finki/tinki/model/Work/Project.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.Jobs;
     1package it.finki.tinki.model.Work;
    22
    33import it.finki.tinki.model.Skill;
  • src/main/java/it/finki/tinki/model/Work/Work.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.Jobs;
     1package it.finki.tinki.model.Work;
    22
    33import it.finki.tinki.model.Users.Account;
  • src/main/java/it/finki/tinki/model/dto/register/account/AccountRegisterDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.register.account;
    22
    33import lombok.Data;
    44
    55@Data
    6 public class TeamRegisterDTO {
     6public class AccountRegisterDTO {
    77    String email;
    88    String password;
    99    String name;
    10     int members;
    1110}
  • src/main/java/it/finki/tinki/model/dto/register/account/UserRegisterDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.register.account;
    22
    33import lombok.Data;
     
    66
    77@Data
    8 public class UserRegisterDTO {
    9     String email;
    10     String password;
    11     String name;
     8public class UserRegisterDTO extends AccountRegisterDTO {
    129    String surname;
    1310    List<Long> retainedSkills;
  • src/main/java/it/finki/tinki/model/dto/response/account/CompanyResponseDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.response.account;
    22
    33import it.finki.tinki.model.Address;
     4import it.finki.tinki.model.dto.response.work.InternshipResponseDTO;
     5import it.finki.tinki.model.dto.response.work.JobResponseDTO;
    46import lombok.Data;
    57
  • src/main/java/it/finki/tinki/model/dto/response/account/LoginResponseDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.response.account;
    22
    33import it.finki.tinki.model.enumerator.AccountType;
  • src/main/java/it/finki/tinki/model/dto/response/account/TeamResponseDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.response.account;
    22
     3import it.finki.tinki.model.dto.response.work.JobResponseDTO;
     4import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
    35import lombok.Data;
    46
     
    79
    810@Data
    9 public class TeamResponseDTO extends LoginResponseDTO{
     11public class TeamResponseDTO extends LoginResponseDTO {
    1012    private int members;
    1113    private List<JobResponseDTO> jobs;
  • src/main/java/it/finki/tinki/model/dto/response/account/UserResponseDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.response.account;
    22
    33import it.finki.tinki.model.Skill;
     4import it.finki.tinki.model.dto.response.work.InternshipResponseDTO;
     5import it.finki.tinki.model.dto.response.work.JobResponseDTO;
     6import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
    47import lombok.Data;
    58
     
    811
    912@Data
    10 public class UserResponseDTO extends LoginResponseDTO{
     13public class UserResponseDTO extends LoginResponseDTO {
    1114    private String surname;
    1215    private List<Skill> retained;
  • src/main/java/it/finki/tinki/model/dto/response/work/JobResponseDTO.java

    rbd38a55 rbd46dbb  
    1 package it.finki.tinki.model.dto;
     1package it.finki.tinki.model.dto.response.work;
    22
    33import it.finki.tinki.model.Address;
    4 import it.finki.tinki.model.Jobs.Job;
     4import it.finki.tinki.model.Work.Job;
    55import it.finki.tinki.model.Users.Company;
    66import it.finki.tinki.model.Users.Team;
     
    99
    1010@Data
    11 public class JobResponseDTO {
    12     Long id;
    13     String title;
    14     String description;
    15     int salary;
    16     String accountEmail;
    17     String accountName;
    18     AccountType accountType;
     11public class JobResponseDTO extends WorkResponseDTO {
    1912    Address accountAddress;
    2013    int members;
    2114
    2215    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();
     16        super(job.getId(), job.getTitle(), job.getDescription(), job.getSalary(), job.getAccount());
    3017        if(job.getAccount().getAccountType()==AccountType.COMPANY){
    3118            this.accountAddress = ((Company) job.getAccount()).getAddress();
  • src/main/java/it/finki/tinki/repository/InternshipRepository.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.repository;
    22
    3 import it.finki.tinki.model.Jobs.Internship;
     3import it.finki.tinki.model.Work.Internship;
    44import org.springframework.data.jpa.repository.JpaRepository;
    55import org.springframework.stereotype.Repository;
  • src/main/java/it/finki/tinki/repository/JobRepository.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.repository;
    22
    3 import it.finki.tinki.model.Jobs.Job;
     3import it.finki.tinki.model.Work.Job;
    44import org.springframework.data.jpa.repository.JpaRepository;
    55import org.springframework.stereotype.Repository;
  • src/main/java/it/finki/tinki/repository/ProjectRepository.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.repository;
    22
    3 import it.finki.tinki.model.Jobs.Project;
     3import it.finki.tinki.model.Work.Project;
    44import org.springframework.data.jpa.repository.JpaRepository;
    55import org.springframework.stereotype.Repository;
  • src/main/java/it/finki/tinki/service/MatchmakerService.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.service;
    22
    3 import it.finki.tinki.model.Jobs.Internship;
    4 import it.finki.tinki.model.Jobs.Job;
    5 import it.finki.tinki.model.Jobs.Project;
     3import it.finki.tinki.model.Work.Internship;
     4import it.finki.tinki.model.Work.Job;
     5import it.finki.tinki.model.Work.Project;
    66import it.finki.tinki.model.Users.User;
    77
  • src/main/java/it/finki/tinki/service/WorkService.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.service;
    22
    3 import it.finki.tinki.model.Jobs.Internship;
    4 import it.finki.tinki.model.Jobs.Job;
    5 import it.finki.tinki.model.Jobs.Project;
     3import it.finki.tinki.model.Work.Internship;
     4import it.finki.tinki.model.Work.Job;
     5import it.finki.tinki.model.Work.Project;
    66import it.finki.tinki.model.enumerator.AccountType;
    77
  • src/main/java/it/finki/tinki/service/impl/AccountServiceImpl.java

    rbd38a55 rbd46dbb  
    22
    33import it.finki.tinki.model.Address;
    4 import it.finki.tinki.model.Jobs.Internship;
    5 import it.finki.tinki.model.Jobs.Job;
    6 import it.finki.tinki.model.Jobs.Project;
     4import it.finki.tinki.model.Work.Internship;
     5import it.finki.tinki.model.Work.Job;
     6import it.finki.tinki.model.Work.Project;
    77import it.finki.tinki.model.Skill;
    88import it.finki.tinki.model.Users.Account;
  • src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java

    rbd38a55 rbd46dbb  
    33import it.finki.tinki.helper.Matchmaker;
    44import it.finki.tinki.model.EmbeddedMatchId;
    5 import it.finki.tinki.model.Jobs.Internship;
    6 import it.finki.tinki.model.Jobs.Job;
    7 import it.finki.tinki.model.Jobs.Project;
     5import it.finki.tinki.model.Work.Internship;
     6import it.finki.tinki.model.Work.Job;
     7import it.finki.tinki.model.Work.Project;
    88import it.finki.tinki.model.Match;
    99import it.finki.tinki.model.Skill;
  • src/main/java/it/finki/tinki/service/impl/WorkServiceImpl.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.service.impl;
    22
    3 import it.finki.tinki.model.Jobs.Internship;
    4 import it.finki.tinki.model.Jobs.Job;
    5 import it.finki.tinki.model.Jobs.Project;
     3import it.finki.tinki.model.Work.Internship;
     4import it.finki.tinki.model.Work.Job;
     5import it.finki.tinki.model.Work.Project;
    66import it.finki.tinki.model.Skill;
    77import it.finki.tinki.model.Users.Account;
  • src/main/java/it/finki/tinki/web/controller/AccountEditController.java

    rbd38a55 rbd46dbb  
    22
    33import it.finki.tinki.model.Skill;
    4 import it.finki.tinki.model.Users.Account;
    54import it.finki.tinki.model.Users.Company;
    65import it.finki.tinki.model.Users.Team;
    76import it.finki.tinki.model.Users.User;
    8 import it.finki.tinki.model.dto.*;
     7import it.finki.tinki.model.dto.register.account.CompanyRegisterDTO;
     8import it.finki.tinki.model.dto.register.account.TeamRegisterDTO;
     9import it.finki.tinki.model.dto.register.account.UserRegisterDTO;
     10import it.finki.tinki.model.dto.response.account.CompanyResponseDTO;
     11import it.finki.tinki.model.dto.response.account.TeamResponseDTO;
     12import it.finki.tinki.model.dto.response.account.UserResponseDTO;
    913import it.finki.tinki.model.enumerator.AccountType;
    1014import it.finki.tinki.service.AccountService;
    1115import it.finki.tinki.service.SkillService;
    12 import org.springframework.web.bind.annotation.PathVariable;
    13 import org.springframework.web.bind.annotation.RequestBody;
    14 import org.springframework.web.bind.annotation.RequestMapping;
    15 import org.springframework.web.bind.annotation.RestController;
     16import org.springframework.web.bind.annotation.*;
    1617
    1718import java.util.List;
     
    3031    }
    3132
    32     @RequestMapping(path = "/user/{id}/{email}")
     33    @PostMapping(path = "/user/{id}/{email}")
    3334    public UserResponseDTO editUser(@PathVariable(name = "id") Long id,
    3435                                    @PathVariable(name = "email") String email,
     
    4849            userResponseDTO.setEmail(u.getEmail());
    4950            userResponseDTO.setType(AccountType.USER);
     51            userResponseDTO.setError(null);
    5052            userResponseDTO.setName(u.getName());
    5153            userResponseDTO.setSurname(u.getSurname());
     
    5961    }
    6062
    61     @RequestMapping(path = "/company/{id}/{email}")
     63    @PostMapping(path = "/company/{id}/{email}")
    6264    public CompanyResponseDTO editCompany(@PathVariable(name = "id") Long id,
    6365                                          @PathVariable(name = "email") String email,
     
    7375            companyResponseDTO.setId(c.getId());
    7476            companyResponseDTO.setEmail(c.getEmail());
     77            companyResponseDTO.setError(null);
    7578            companyResponseDTO.setType(AccountType.COMPANY);
    7679            companyResponseDTO.setName(c.getName());
     
    8386    }
    8487
    85     @RequestMapping(path = "/team/{id}/{email}")
     88    @PostMapping(path = "/team/{id}/{email}")
    8689    public TeamResponseDTO editTeam(@PathVariable(name = "id") Long id,
    8790                                    @PathVariable(name = "email") String email,
     
    97100            teamResponseDTO.setId(t.getId());
    98101            teamResponseDTO.setEmail(t.getEmail());
     102            teamResponseDTO.setError(null);
    99103            teamResponseDTO.setType(AccountType.TEAM);
    100104            teamResponseDTO.setName(t.getName());
  • src/main/java/it/finki/tinki/web/controller/LoginController.java

    rbd38a55 rbd46dbb  
    11package it.finki.tinki.web.controller;
    22
    3 import it.finki.tinki.model.Jobs.Internship;
    4 import it.finki.tinki.model.Jobs.Job;
    5 import it.finki.tinki.model.Jobs.Project;
     3import it.finki.tinki.model.Work.Internship;
     4import it.finki.tinki.model.Work.Job;
     5import it.finki.tinki.model.Work.Project;
    66import it.finki.tinki.model.Users.Account;
    77import it.finki.tinki.model.Users.Company;
     
    99import it.finki.tinki.model.Users.User;
    1010import it.finki.tinki.model.dto.*;
     11import it.finki.tinki.model.dto.response.account.LoginResponseDTO;
     12import it.finki.tinki.model.dto.response.account.CompanyResponseDTO;
     13import it.finki.tinki.model.dto.response.account.TeamResponseDTO;
     14import it.finki.tinki.model.dto.response.account.UserResponseDTO;
     15import it.finki.tinki.model.dto.response.work.InternshipResponseDTO;
     16import it.finki.tinki.model.dto.response.work.JobResponseDTO;
     17import it.finki.tinki.model.dto.response.work.ProjectResponseDTO;
    1118import it.finki.tinki.model.enumerator.AccountType;
    1219import it.finki.tinki.service.AccountService;
  • src/main/java/it/finki/tinki/web/controller/RegisterController.java

    rbd38a55 rbd46dbb  
    33import it.finki.tinki.model.Skill;
    44import it.finki.tinki.model.Users.Account;
    5 import it.finki.tinki.model.dto.CompanyRegisterDTO;
    6 import it.finki.tinki.model.dto.TeamRegisterDTO;
    7 import it.finki.tinki.model.dto.UserRegisterDTO;
     5import it.finki.tinki.model.dto.register.account.CompanyRegisterDTO;
     6import it.finki.tinki.model.dto.register.account.TeamRegisterDTO;
     7import it.finki.tinki.model.dto.register.account.UserRegisterDTO;
    88import it.finki.tinki.service.AccountService;
    99import it.finki.tinki.service.MatchmakerService;
Note: See TracChangeset for help on using the changeset viewer.