From 43d637e5b412f107f541717ac17d014edaad67e1 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 00:25:03 +0300 Subject: [PATCH 01/15] chore: removed typo --- .../hydraulic/applyforme/service/impl/CountryServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/CountryServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/CountryServiceImpl.java index 7e9f4fc3..8ba9d1a8 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/CountryServiceImpl.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/CountryServiceImpl.java @@ -48,7 +48,7 @@ public void seedCountryRecords() throws JsonProcessingException { try { for (Country country : countriesList) { - gi Optional countryExists = jpaRepository.findByTitleAndAbbreviation(country.getTitle(), country.getAbbreviation()); + Optional countryExists = jpaRepository.findByTitleAndAbbreviation(country.getTitle(), country.getAbbreviation()); if (countryExists.isPresent()) { continue; From cd5e2c0ee72985696b950abf2d4c40606fd7f0ee Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:50:44 +0300 Subject: [PATCH 02/15] Commented out some error code in CountryDto.java --- .../com/hydraulic/applyforme/model/dto/country/CountryDto.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/country/CountryDto.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/country/CountryDto.java index 20acf011..3eb534c3 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/country/CountryDto.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/country/CountryDto.java @@ -17,4 +17,6 @@ public class CountryDto { @NotNull(message = "{country.abbreviation.notNull}") @Size(min = 3, max = 10, message = "{country.abbreviation.size}") private String abbreviation; + + //abbreviationName } From 592495d67c6824a89d587f4e4a66eb5dd4d4cdf8 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:51:55 +0300 Subject: [PATCH 03/15] Created the ProfessionalProfileController.java --- .../ProfessionalProfileController.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java new file mode 100644 index 00000000..0413a833 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java @@ -0,0 +1,35 @@ +package com.hydraulic.applyforme.controller; + +import com.hydraulic.applyforme.model.domain.ProfessionalProfile; +import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; + +import com.hydraulic.applyforme.service.ProfessionalProfileService; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +@RequestMapping( + value = "profile", + produces = {MediaType.APPLICATION_JSON_VALUE}, + consumes = {MediaType.APPLICATION_JSON_VALUE} +) + +public class ProfessionalProfileController { + + private final ProfessionalProfileService service; + + public ProfessionalProfileController(ProfessionalProfileService service){ + this.service = service; + } + + @PostMapping("/add-professional-profile") + public ProfessionalProfile saveProfile(@Validated @RequestBody ProfessionalProfileDto professionalProfileDto){ + return service.createProfile(professionalProfileDto); + } + +} From 85689717cca7da20275d3a3b3f30bb1eb59f25ca Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:53:55 +0300 Subject: [PATCH 04/15] feat: Created ProfessionalProfileJpaRepository.java --- .../repository/jpa/ProfessionalProfileJpaRepository.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/ProfessionalProfileJpaRepository.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/ProfessionalProfileJpaRepository.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/ProfessionalProfileJpaRepository.java new file mode 100644 index 00000000..ba9a1b50 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/ProfessionalProfileJpaRepository.java @@ -0,0 +1,8 @@ +package com.hydraulic.applyforme.repository.jpa; + +import com.hydraulic.applyforme.model.domain.ProfessionalProfile; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ProfessionalProfileJpaRepository extends JpaRepository { + +} From 66ccf09a3bd36ac396a09e2a043455b2d7da73ae Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:55:23 +0300 Subject: [PATCH 05/15] feat: Addded ProfessionalProfileService.java --- .../applyforme/service/ProfessionalProfileService.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java new file mode 100644 index 00000000..6b101946 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java @@ -0,0 +1,9 @@ +package com.hydraulic.applyforme.service; + +import com.hydraulic.applyforme.model.domain.ProfessionalProfile; +import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; + +public interface ProfessionalProfileService { + + ProfessionalProfile createProfile(ProfessionalProfileDto body); +} From 8d2770a78da3795fe462db85a2739d91f1368b6f Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:56:41 +0300 Subject: [PATCH 06/15] feat: Added ProfessionalProfileServiceImpl.java --- .../impl/ProfessionalProfileServiceImpl.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java new file mode 100644 index 00000000..8c8d4236 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java @@ -0,0 +1,37 @@ +package com.hydraulic.applyforme.service.impl; + +import com.hydraulic.applyforme.model.domain.ProfessionalProfile; +import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; +import com.hydraulic.applyforme.repository.jpa.ProfessionalProfileJpaRepository; +import com.hydraulic.applyforme.service.ProfessionalProfileService; +import lombok.extern.slf4j.Slf4j; +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.transaction.Transactional; + +@Slf4j +@Service +public class ProfessionalProfileServiceImpl implements ProfessionalProfileService { + + @Autowired + private ModelMapper modelMapper; + + private final ProfessionalProfileJpaRepository repository; + + + public ProfessionalProfileServiceImpl(ProfessionalProfileJpaRepository repository) { + this.repository = repository; + } + + @Override + @Transactional + public ProfessionalProfile createProfile(ProfessionalProfileDto body) { + + ProfessionalProfile professionalProfile; + professionalProfile = modelMapper.map(body, ProfessionalProfile.class); + + return repository.save(professionalProfile); + } +} From e2155de2ae55da781dd4f43c14aa3e16b1136fce Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 18:00:27 +0300 Subject: [PATCH 07/15] feat: Created ProfessionalProfileDto. Added validation to profileTitle and mainProfile --- .../ProfessionalProfileDto.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/professionalProfile/ProfessionalProfileDto.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/professionalProfile/ProfessionalProfileDto.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/professionalProfile/ProfessionalProfileDto.java new file mode 100644 index 00000000..5c781606 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/dto/professionalProfile/ProfessionalProfileDto.java @@ -0,0 +1,49 @@ +package com.hydraulic.applyforme.model.dto.professionalProfile; + +import com.hydraulic.applyforme.model.enums.EmploymentType; +import com.hydraulic.applyforme.model.enums.JobLocationType; +import com.hydraulic.applyforme.model.enums.JobSeniority; +import lombok.*; + +import javax.validation.constraints.NotNull; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class ProfessionalProfileDto { + + @NotNull(message = "Profile title cannot be null") + private String profileTitle; + + @NotNull(message = "Main profile title cannot be null") + private Boolean mainProfile; + + private String passportLink; + + private String resumeLink; + + private String cover_letter; + + private String salaryRange; + + private EmploymentType employmentType; + + private String jobLocation; + + private JobLocationType preferredJobLocationType; + + private JobSeniority jobSeniority; + + private String desiredJobTitle; + + private String industry; + + private Integer yearsOfExperience; + + private String otherSkills; + + private String otherComment; + + private String includedKeywords; +} From 79eab31a8a55d9dc2c841c95256610defa706ab1 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 18:01:52 +0300 Subject: [PATCH 08/15] chore: Whitespace changes as a result of viewing code. Changes don't affect previous code. Ignore --- .../controller/CoverLetterController.java | 8 +++---- .../InvalidOldPasswordException.java | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/exception/InvalidOldPasswordException.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java index 151489b4..bc07f6d3 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java @@ -1,9 +1,9 @@ package com.hydraulic.applyforme.controller; -<<<<<<< HEAD -======= -import com.hydraulic.applyforme.model.domain.Country; ->>>>>>> 85d46d3654f56e17b948fda682b7e825e37a1d85 +//<<<<<<< HEAD +//======= +//import com.hydraulic.applyforme.model.domain.Country; +//>>>>>>> 85d46d3654f56e17b948fda682b7e825e37a1d85 import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/exception/InvalidOldPasswordException.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/exception/InvalidOldPasswordException.java new file mode 100644 index 00000000..2817ed8f --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/model/exception/InvalidOldPasswordException.java @@ -0,0 +1,21 @@ +package com.hydraulic.applyforme.model.exception; + +public class InvalidOldPasswordException extends RuntimeException{ + private static final long serialVersionUID = 5861310537366287163L; + + public InvalidOldPasswordException() { + super(); + } + + public InvalidOldPasswordException(final String message, final Throwable cause) { + super(message, cause); + } + + public InvalidOldPasswordException(final String message) { + super(message); + } + + public InvalidOldPasswordException(final Throwable cause) { + super(cause); + } +} From 0bcac7020e7828c29f7cbc941f886ca5597354b6 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sat, 19 Nov 2022 18:15:49 +0300 Subject: [PATCH 09/15] feat/(BE-45): Add Job Profile endpoint --- .../applyforme/controller/CoverLetterController.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java index bc07f6d3..3a4a08c9 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/CoverLetterController.java @@ -1,9 +1,4 @@ package com.hydraulic.applyforme.controller; - -//<<<<<<< HEAD -//======= -//import com.hydraulic.applyforme.model.domain.Country; -//>>>>>>> 85d46d3654f56e17b948fda682b7e825e37a1d85 import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; From 93730ca2411d75fdc9ce66bd25452fd559d65178 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 14:16:42 +0300 Subject: [PATCH 10/15] feat: Resolving the issue of DTO not submitting to entity --- .../controller/ProfessionalProfileController.java | 1 + .../service/impl/ProfessionalProfileServiceImpl.java | 9 ++++++++- Apply-For-Me-Api/src/main/resources/ddm/queries.sql | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java index 0413a833..2c0c37af 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java @@ -4,6 +4,7 @@ import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; import com.hydraulic.applyforme.service.ProfessionalProfileService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java index 8c8d4236..80e8a509 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java @@ -1,5 +1,6 @@ package com.hydraulic.applyforme.service.impl; +import com.hydraulic.applyforme.model.domain.Professional; import com.hydraulic.applyforme.model.domain.ProfessionalProfile; import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; import com.hydraulic.applyforme.repository.jpa.ProfessionalProfileJpaRepository; @@ -29,9 +30,15 @@ public ProfessionalProfileServiceImpl(ProfessionalProfileJpaRepository repositor @Transactional public ProfessionalProfile createProfile(ProfessionalProfileDto body) { - ProfessionalProfile professionalProfile; + ProfessionalProfile professionalProfile = new ProfessionalProfile(); + Professional professional = new Professional(); + professionalProfile = modelMapper.map(body, ProfessionalProfile.class); + professionalProfile.setProfessional(professional); + return repository.save(professionalProfile); + + professionalProfile.setProfessional(professionalRepository.getByEmail()); } } diff --git a/Apply-For-Me-Api/src/main/resources/ddm/queries.sql b/Apply-For-Me-Api/src/main/resources/ddm/queries.sql index ad3874f3..55b4ebbe 100644 --- a/Apply-For-Me-Api/src/main/resources/ddm/queries.sql +++ b/Apply-For-Me-Api/src/main/resources/ddm/queries.sql @@ -1,2 +1,2 @@ -INSERT INTO `professional` (linkedin_link, facebook_link, twitter_link, instagram_link, other_link_1, other_link_2, other_link_3, hobbies); +# INSERT INTO `professional` (linkedin_link, facebook_link, twitter_link, instagram_link, other_link_1, other_link_2, other_link_3, hobbies); From a6d86e8858ded2b5872cb17bdf151f709561eb0c Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:43:24 +0300 Subject: [PATCH 11/15] feat: implemented saveProfile method that takes in DTO --- .../applyforme/controller/ProfessionalProfileController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java index 2c0c37af..4ab71916 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ProfessionalProfileController.java @@ -30,7 +30,6 @@ public ProfessionalProfileController(ProfessionalProfileService service){ @PostMapping("/add-professional-profile") public ProfessionalProfile saveProfile(@Validated @RequestBody ProfessionalProfileDto professionalProfileDto){ - return service.createProfile(professionalProfileDto); + return service.createProfessionalProfile(professionalProfileDto); } - } From f9eff0badd5163c26ed2f3cccb3c9f45d93b5e7e Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:45:17 +0300 Subject: [PATCH 12/15] feat: implemented and modified method to getProfessionalByMemberId for clarity --- .../applyforme/repository/ProfessionalRepository.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/ProfessionalRepository.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/ProfessionalRepository.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/ProfessionalRepository.java new file mode 100644 index 00000000..cbe64523 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/ProfessionalRepository.java @@ -0,0 +1,7 @@ +package com.hydraulic.applyforme.repository; + +import com.hydraulic.applyforme.model.domain.Professional; + +public interface ProfessionalRepository { + Professional getProfessionalByMemberId(Long id); +} From 57b356c9796568388f9bde857080acb4cddecd06 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:47:17 +0300 Subject: [PATCH 13/15] feat: getProfessionalByMemberId implementation --- .../impl/ProfessionalRepositoryImpl.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/impl/ProfessionalRepositoryImpl.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/impl/ProfessionalRepositoryImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/impl/ProfessionalRepositoryImpl.java new file mode 100644 index 00000000..8aa89260 --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/impl/ProfessionalRepositoryImpl.java @@ -0,0 +1,21 @@ +package com.hydraulic.applyforme.repository.impl; + +import com.hydraulic.applyforme.model.domain.Professional; +import com.hydraulic.applyforme.repository.ProfessionalRepository; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +@Repository +public class ProfessionalRepositoryImpl implements ProfessionalRepository { + + @PersistenceContext + private EntityManager entityManager; + + + @Override + public Professional getProfessionalByMemberId(Long id) { + return entityManager.find(Professional.class, id); + } +} From 4bb9322452237fabcc6e38b66958162e9ec9cdfe Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:49:20 +0300 Subject: [PATCH 14/15] feat: ProfessionalProfileService interface and implementation. Returns professional --- .../service/ProfessionalProfileService.java | 2 +- .../impl/ProfessionalProfileServiceImpl.java | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java index 6b101946..89b05662 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalProfileService.java @@ -5,5 +5,5 @@ public interface ProfessionalProfileService { - ProfessionalProfile createProfile(ProfessionalProfileDto body); + ProfessionalProfile createProfessionalProfile(ProfessionalProfileDto body); } diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java index 80e8a509..c63b06ce 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalProfileServiceImpl.java @@ -3,6 +3,9 @@ import com.hydraulic.applyforme.model.domain.Professional; import com.hydraulic.applyforme.model.domain.ProfessionalProfile; import com.hydraulic.applyforme.model.dto.professionalProfile.ProfessionalProfileDto; +import com.hydraulic.applyforme.model.enums.EmploymentType; +import com.hydraulic.applyforme.repository.ProfessionalRepository; +import com.hydraulic.applyforme.repository.jpa.MemberJpaRepository; import com.hydraulic.applyforme.repository.jpa.ProfessionalProfileJpaRepository; import com.hydraulic.applyforme.service.ProfessionalProfileService; import lombok.extern.slf4j.Slf4j; @@ -16,29 +19,26 @@ @Service public class ProfessionalProfileServiceImpl implements ProfessionalProfileService { + MemberJpaRepository memberJpaRepository; + @Autowired private ModelMapper modelMapper; - private final ProfessionalProfileJpaRepository repository; + @Autowired + private ProfessionalRepository professionalRepository; + ProfessionalProfile professionalProfile; + ProfessionalProfileJpaRepository professionalProfileJpaRepository; - public ProfessionalProfileServiceImpl(ProfessionalProfileJpaRepository repository) { - this.repository = repository; - } @Override @Transactional - public ProfessionalProfile createProfile(ProfessionalProfileDto body) { - - ProfessionalProfile professionalProfile = new ProfessionalProfile(); - Professional professional = new Professional(); - - professionalProfile = modelMapper.map(body, ProfessionalProfile.class); + public ProfessionalProfile createProfessionalProfile(ProfessionalProfileDto body) { - professionalProfile.setProfessional(professional); + professionalProfile = modelMapper.map(body, ProfessionalProfile.class); //model maps everything to entity except id + //need to find a way to map professional_id in Professional entity to ProfessionalProfile professional_id - return repository.save(professionalProfile); + return professionalProfileJpaRepository.save(professionalProfile); - professionalProfile.setProfessional(professionalRepository.getByEmail()); } } From 59154fee19adc5e65e4c1eb5552456af152d6b62 Mon Sep 17 00:00:00 2001 From: Bradley <39657175+bradl33@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:52:35 +0300 Subject: [PATCH 15/15] feat(BE-45): add-job-profile ticket --- .../repository/jpa/RoleJpaRepository.java | 2 +- .../service/ProfessionalService.java | 8 ++++++ .../service/impl/ProfessionalServiceImpl.java | 26 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalService.java create mode 100644 Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalServiceImpl.java diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/RoleJpaRepository.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/RoleJpaRepository.java index bb8abdb6..cace7745 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/RoleJpaRepository.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/repository/jpa/RoleJpaRepository.java @@ -10,4 +10,4 @@ public interface RoleJpaRepository extends JpaRepository { Optional findByTitleAndCode(String title, String code); Optional findByCode(String code); -} +} \ No newline at end of file diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalService.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalService.java new file mode 100644 index 00000000..8f2aa34d --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ProfessionalService.java @@ -0,0 +1,8 @@ +package com.hydraulic.applyforme.service; + +import com.hydraulic.applyforme.model.domain.Professional; + +public interface ProfessionalService { + + Professional findProfessionalByMemberId(Long id); +} diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalServiceImpl.java new file mode 100644 index 00000000..8864588f --- /dev/null +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ProfessionalServiceImpl.java @@ -0,0 +1,26 @@ +package com.hydraulic.applyforme.service.impl; + +import com.hydraulic.applyforme.model.domain.Professional; +import com.hydraulic.applyforme.repository.ProfessionalRepository; +import com.hydraulic.applyforme.service.ProfessionalService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +public class ProfessionalServiceImpl implements ProfessionalService { + + private final ProfessionalRepository repository; + + + public ProfessionalServiceImpl(ProfessionalRepository repository) { + this.repository = repository; + } + + @Override + //use Professional returned from repo to set professional + public Professional findProfessionalByMemberId(Long id) { + Professional professional = repository.getProfessionalByMemberId(id); + return professional; + } +}