Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/be 45 add job profile #137

Open
wants to merge 19 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e69a425
Merge remote-tracking branch 'origin/development' into feat/BE-14-sup…
bradl33 Nov 18, 2022
43d637e
chore: removed typo
bradl33 Nov 18, 2022
cc4e76a
Merge remote-tracking branch 'origin/development' into feat/BE-45-add…
bradl33 Nov 19, 2022
cd5e2c0
Commented out some error code in CountryDto.java
bradl33 Nov 19, 2022
592495d
Created the ProfessionalProfileController.java
bradl33 Nov 19, 2022
8568971
feat: Created ProfessionalProfileJpaRepository.java
bradl33 Nov 19, 2022
66ccf09
feat: Addded ProfessionalProfileService.java
bradl33 Nov 19, 2022
8d2770a
feat: Added ProfessionalProfileServiceImpl.java
bradl33 Nov 19, 2022
e2155de
feat: Created ProfessionalProfileDto. Added validation to profileTitl…
bradl33 Nov 19, 2022
79eab31
chore: Whitespace changes as a result of viewing code. Changes don't …
bradl33 Nov 19, 2022
0bcac70
feat/(BE-45): Add Job Profile endpoint
bradl33 Nov 19, 2022
f73c281
Merge branch 'development' into feat/BE-45-add-job-profile
bradl33 Nov 19, 2022
93730ca
feat: Resolving the issue of DTO not submitting to entity
bradl33 Nov 20, 2022
13edc9a
Merge branch 'development' into feat/BE-45-add-job-profile
bradl33 Nov 20, 2022
a6d86e8
feat: implemented saveProfile method that takes in DTO
bradl33 Nov 20, 2022
f9eff0b
feat: implemented and modified method to getProfessionalByMemberId fo…
bradl33 Nov 20, 2022
57b356c
feat: getProfessionalByMemberId implementation
bradl33 Nov 20, 2022
4bb9322
feat: ProfessionalProfileService interface and implementation. Return…
bradl33 Nov 20, 2022
59154fe
feat(BE-45): add-job-profile ticket
bradl33 Nov 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.beans.factory.annotation.Autowired;
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.createProfessionalProfile(professionalProfileDto);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.hydraulic.applyforme.repository;

import com.hydraulic.applyforme.model.domain.Professional;

public interface ProfessionalRepository {
Professional getProfessionalByMemberId(Long id);
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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<ProfessionalProfile, Long> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public interface RoleJpaRepository extends JpaRepository<Role, Long> {
Optional<Role> findByTitleAndCode(String title, String code);
Optional<Role> findByCode(String code);

}
}
Original file line number Diff line number Diff line change
@@ -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 createProfessionalProfile(ProfessionalProfileDto body);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.hydraulic.applyforme.service;

import com.hydraulic.applyforme.model.domain.Professional;

public interface ProfessionalService {

Professional findProfessionalByMemberId(Long id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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.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;
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 {

MemberJpaRepository memberJpaRepository;

@Autowired
private ModelMapper modelMapper;

@Autowired
private ProfessionalRepository professionalRepository;

ProfessionalProfile professionalProfile;
ProfessionalProfileJpaRepository professionalProfileJpaRepository;


@Override
@Transactional
public ProfessionalProfile createProfessionalProfile(ProfessionalProfileDto body) {

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 professionalProfileJpaRepository.save(professionalProfile);

}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
2 changes: 1 addition & 1 deletion Apply-For-Me-Api/src/main/resources/ddm/queries.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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);

INSERT INTO `professional_profile`
(profile_title, passport_link, resume_link, cover_letter, employment_type, salary_range, job_location, preferred_job_location_type,
Expand Down