Skip to content

Commit

Permalink
Merge branch 'develop' into feature-1789/BE-user-input-previous-emplo…
Browse files Browse the repository at this point in the history
…yment
  • Loading branch information
BenVuong committed Aug 5, 2022
2 parents abc3db4 + 1db5a14 commit bae61d6
Show file tree
Hide file tree
Showing 25 changed files with 1,930 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
package com.objectcomputing.checkins.services.onboard;

import io.micronaut.core.annotation.Introspected;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.data.annotation.AutoPopulated;
import io.micronaut.data.annotation.TypeDef;
import io.micronaut.data.jdbc.annotation.ColumnTransformer;
import io.micronaut.data.model.DataType;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.Objects;
import java.util.UUID;


//this file contains the variables and coloum names for the edit onboardee modal component.
@Entity
@Introspected
@Table(name = "edit_onboardee_profile")
public class OnboardeeProfile {
@Id // indicates this member field below is the primary key of the current entity
@Column(name = "id") // indicates this value is stored under a column in the database with the name
// "id"
@AutoPopulated // Micronaut will autopopulate a user id for each onboardee's profile
// automatically
@TypeDef(type = DataType.STRING) // indicates what type of data will be stored in the database
@Schema(description = "id of the new employee profile this entry is associated with", required = true)
private UUID id;

@NotBlank // the below field,firstName, is not allowed to be blank on submission
@Column(name = "firstname")
@ColumnTransformer(read = "pgp_sym_decrypt(firstName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
// @columnTransformer and the code that follows allows the firstname field to be
// stored as encrypted in the database and then decrypted if you want to read
// it.
@Schema(description = "first name of the new employee")
private String firstName;

@NotBlank
@Column(name = "lastname")
@ColumnTransformer(read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
@Schema(description = "last name of the new employee")
private String lastName;

@NotBlank
@Column(name = "position")
@ColumnTransformer(read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
@Schema(description = "The position of the new employee")
private String position;

@NotBlank
@Column(name = "hiretype")
@ColumnTransformer(read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
@Schema(description = "The hire type of the new employee")
private String hireType;

@NotBlank
@Column(name = "email")
@ColumnTransformer(read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
@Schema(description = "The email of the new employee")
private String email;

@NotBlank
@Column(name = "pdl")
@ColumnTransformer(read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')", write = "pgp_sym_encrypt(?,'${aes.key}') ")
@Schema(description = "The pdl of the new employee")
private String pdl;

public OnboardeeProfile(String firstName, String lastName, String position, String hireType, String email,
String pdl) {
this.firstName = firstName;
this.lastName = lastName;
this.position = position;
this.hireType = hireType;
this.email = email;
this.pdl = pdl;
}

public OnboardeeProfile(UUID id, String firstName, String lastName, String position, String hireType,
String email, String pdl) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.position = position;
this.hireType = hireType;
this.email = email;
this.pdl = pdl;
}

public OnboardeeProfile() {
}

public void setId(UUID id) {
this.id = id;
}

public UUID getId() {
return id;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public void setPosition(String position) {
this.position = position;
}

public String getPosition() {
return position;
}

public void setHireType(String hireType) {
this.hireType = hireType;
}

public String getHireType() {
return hireType;
}

public void setEmail(String email) {
this.email = email;
}

public String getEmail() {
return email;
}

public void setPdl(String pdl) {
this.pdl = pdl;
}

public String getPdl() {
return pdl;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
OnboardeeProfile that = (OnboardeeProfile) o;
return Objects.equals(id, that.id) &&
Objects.equals(firstName, that.firstName) &&
Objects.equals(lastName, that.lastName) &&
Objects.equals(position, that.position) &&
Objects.equals(hireType, that.hireType) &&
Objects.equals(email, that.email) &&
Objects.equals(pdl, that.pdl);
}

@Override
public int hashCode() {
return Objects.hash(id, firstName, lastName, position, hireType, email, pdl);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.objectcomputing.checkins.services.onboard;

import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.*;
import io.micronaut.scheduling.TaskExecutors;
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.rules.SecurityRule;
import io.netty.channel.EventLoopGroup;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.api.services.gmail.model.Profile;

import jakarta.inject.Named;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.net.URI;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;

@Controller("/services/onboardee-profiles")
@Secured(SecurityRule.IS_AUTHENTICATED)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Tag(name = "onboardee profiles")
public class OnboardeeProfileController {
private static final Logger LOG = LoggerFactory.getLogger(OnboardeeProfileServices.class);
private final OnboardeeProfileServices onboardeeProfileServices;
private final EventLoopGroup eventLoopGroup;
private final Scheduler scheduler;

public OnboardeeProfileController(OnboardeeProfileServices onboardeeProfileServices, EventLoopGroup eventLoopGroup,
@Named(TaskExecutors.IO) ExecutorService ioExecutorService) {
this.onboardeeProfileServices = onboardeeProfileServices;
this.eventLoopGroup = eventLoopGroup;
this.scheduler = Schedulers.fromExecutor(ioExecutorService);
}

// @Get("/{id}")
// public Mono<HttpResponse<OnboardeeProfileDTO>> getById(UUID id) {
// return Mono.fromCallable(() -> onboardeeProfileServices.getById(id))
// .publishOn(Schedulers.fromExecutor(eventLoopGroup))
// .map(profile -> (HttpResponse<OnboardeeProfileDTO>) HttpResponse
// .ok(fromEntity(profile))
// .headers(headers -> headers.location(location(profile.getId()))))
// .subscribeOn(scheduler);
// }

// @Get("/{?id,firstName,lastName,postion,hireType,email,pdl}")
// public Mono<HttpResponse<List<OnboardeeProfileDTO>>> findByValue(@Nullable UUID id,
// )


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.objectcomputing.checkins.services.onboard;

import io.micronaut.core.annotation.Introspected;
import io.swagger.v3.oas.annotations.media.Schema;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.UUID;

@Introspected
public class OnboardeeProfileDTO {
@NotNull
@Schema(description = "id of the onboardee this profile entry is associated with", required = true)
private UUID id;

@NotBlank //the below field,firstName, is not allowed to be blank on submission
@Schema(description = "first name of the new onboardee")
private String firstName;

@NotBlank
@Schema(description = "last name of the new onboardee")
private String lastName;

@NotBlank
@Schema(description = "position of the new onboardee")
private String position;

@NotBlank
@Schema(description = "hire type of the new onboardee")
private String hireType;

@NotBlank
@Schema(description = "email of the new onboardee")
private String email;

@NotBlank
@Schema(description = "pdl of the new onboardee")
private String pdl;

public void setId(UUID id) {
this.id = id;
}

public UUID getId() {
return id;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public void setPosition(String position) {
this.position = position;
}

public String getPosition() {
return position;
}

public void setHireType(String hireType) {
this.hireType = hireType;
}

public String getHireType() {
return hireType;
}

public void setEmail(String email) {
this.email = email;
}

public String getEmail() {
return email;
}

public void setPdl(String pdl) {
this.pdl = pdl;
}

public String getPdl() {
return pdl;
}

@Override
public String toString() {
return "OnboardeeProfileDTO{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName +'\'' +
", position='" + position +'\'' +
", hireType='" + hireType +'\'' +
", email='" + email + '\'' +
", pdl='" + pdl + '\'' + '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.objectcomputing.checkins.services.onboard;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import java.util.UUID;

public class OnboardeeProfileServices {
//OnboardeeProfile getById(UUID id);

}
Loading

0 comments on commit bae61d6

Please sign in to comment.