Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a1f7ba4
[2345] Delete updatedDate parameter from PulseResponse
S78901 May 9, 2024
ca28791
[2345] Drop column updatedDate from Database
S78901 May 9, 2024
6126b16
[2345] Add internal_score + external_score columns
S78901 May 9, 2024
4db0c61
[2345] Add internalScore and externalScore
S78901 May 9, 2024
d4efd3a
[2345] Add test parameters for internalScore and externalScore
S78901 May 9, 2024
26a8b7f
[2345] Fix test
S78901 May 9, 2024
d8811cd
[2345] Adjustment of defaultPulseResponse to 0 0 for new params
S78901 May 9, 2024
6f7c3eb
[2345] Adjustments for build issues
S78901 May 9, 2024
44f3b9c
[2345] Test fixes round 1
S78901 May 9, 2024
fa96555
[2345] More test fixes
S78901 May 9, 2024
61e3419
[2345] Adjust public/protected
S78901 May 9, 2024
1041d2c
[2345] Small test fixes
S78901 May 9, 2024
bac46b5
[2345] A few more changes
S78901 May 9, 2024
580d69c
Merge branch 'develop' into feature-2345/update-pulse-response-object
S78901 May 9, 2024
7b20635
[2345] Format adjustment
S78901 May 10, 2024
0607ecb
Merge branch 'feature-2345/update-pulse-response-object' of https://g…
S78901 May 10, 2024
03e5deb
[2345] Fix failing test
S78901 May 10, 2024
18e66a1
[2345] Adjust failing test
S78901 May 10, 2024
296ab53
[2345] Formatting
S78901 May 10, 2024
9ed2ca1
[2345] Correct the right test
S78901 May 10, 2024
5d412cf
[2345] Change new fields to be Nullable
S78901 May 10, 2024
95f9844
[2345] Fix failing tests from new changes
S78901 May 10, 2024
b7e35f8
Merge remote-tracking branch 'origin/develop' into feature-2345/updat…
S78901 May 20, 2024
a64f90f
[2345] Nullable/NotNull changes, error cleanup
S78901 May 20, 2024
c8aacf5
[2345] Fix PulseResponseControllerTest
S78901 May 20, 2024
e1a27a9
[2345] Fix PulseResponseCreateDTOTest
S78901 May 20, 2024
aa4198e
[2345] Fix PulseResponseTest
S78901 May 20, 2024
1fe989a
[2345] One more fix for PulseResponseControllerTest
S78901 May 20, 2024
decdb7b
[2345] Update failing tests and snapshotsetc
S78901 May 20, 2024
913c1e9
[2345] Run update for snapshots
S78901 May 20, 2024
c7baaf7
[2345] Standardize Pulse test to upcoming version on other branch
S78901 May 20, 2024
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
Expand Up @@ -2,6 +2,7 @@

import com.objectcomputing.checkins.converter.LocalDateConverter;
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.annotation.sql.ColumnTransformer;
Expand All @@ -23,7 +24,6 @@
@Entity
@Getter
@Setter
@NoArgsConstructor
@Introspected
@Table(name = "pulse_response")
public class PulseResponse {
Expand All @@ -35,18 +35,22 @@ public class PulseResponse {
@Schema(description = "the id of the pulse_response")
private UUID id;

@Column(name="internal_score")
@NotNull
@Schema(description = "integer for internalScore", required = true)
private Integer internalScore;

@Column(name="external_score")
@Nullable
@Schema(description = "integer for externalScore", required = true)
private Integer externalScore;

@Column(name="submissiondate")
@NotNull
@Schema(description = "date for submissionDate")
@TypeDef(type = DataType.DATE, converter = LocalDateConverter.class)
private LocalDate submissionDate;

@Column(name="updateddate")
@NotNull
@Schema(description = "date for updatedDate")
@TypeDef(type = DataType.DATE, converter = LocalDateConverter.class)
private LocalDate updatedDate;

@Column(name="teammemberid")
@TypeDef(type=DataType.STRING)
@NotNull
Expand All @@ -58,7 +62,7 @@ public class PulseResponse {
read = "pgp_sym_decrypt(internalFeelings::bytea,'${aes.key}')",
write = "pgp_sym_encrypt(?,'${aes.key}') "
)
@NotNull
@Nullable
@Schema(description = "description of internalfeelings")
private String internalFeelings;

Expand All @@ -67,21 +71,81 @@ public class PulseResponse {
read = "pgp_sym_decrypt(externalFeelings::bytea,'${aes.key}')",
write = "pgp_sym_encrypt(?,'${aes.key}') "
)
@NotNull
@Nullable
@Schema(description = "description of externalfeelings")
private String externalFeelings;

public PulseResponse(UUID id,LocalDate submissionDate,LocalDate updatedDate, UUID teamMemberId, String internalFeelings, String externalFeelings) {
protected PulseResponse() {
}

public PulseResponse(UUID id, Integer internalScore, Integer externalScore, LocalDate submissionDate, UUID teamMemberId, String internalFeelings, String externalFeelings) {
this.id = id;
this.internalScore = internalScore;
this.externalScore = externalScore;
this.submissionDate = submissionDate;
this.updatedDate = updatedDate;
this.teamMemberId = teamMemberId;
this.internalFeelings = internalFeelings;
this.externalFeelings = externalFeelings;
}

public PulseResponse(LocalDate submissionDate,LocalDate updatedDate, UUID teamMemberId, String internalFeelings, String externalFeelings) {
this(null,submissionDate, updatedDate, teamMemberId, internalFeelings, externalFeelings);
public PulseResponse(Integer internalScore, Integer externalScore, LocalDate submissionDate, UUID teamMemberId, String internalFeelings, String externalFeelings) {
this(null,internalScore, externalScore, submissionDate, teamMemberId, internalFeelings, externalFeelings);
}

public UUID getId() {
return this.id;
}

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

public Integer getInternalScore() {
return internalScore;
}

public void setInternalScore(Integer internalScore) {
this.internalScore = internalScore;
}

public Integer getExternalScore() {
return externalScore;
}

public void setExternalScore(Integer externalScore) {
this.externalScore = externalScore;
}

public LocalDate getSubmissionDate() {
return submissionDate;
}

public void setSubmissionDate(LocalDate submissionDate) {
this.submissionDate = submissionDate;
}

public UUID getTeamMemberId() {
return this.teamMemberId;
}

public void setTeamMemberId(UUID teamMemberId) {
this.teamMemberId = teamMemberId;
}

public String getInternalFeelings() {
return internalFeelings;
}

public void setInternalFeelings(String internalFeelings) {
this.internalFeelings = internalFeelings;
}

public String getExternalFeelings() {
return externalFeelings;
}

public void setExternalFeelings(String externalFeelings) {
this.externalFeelings = externalFeelings;
}

@Override
Expand All @@ -90,6 +154,8 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
PulseResponse that = (PulseResponse) o;
return Objects.equals(id, that.id) &&
Objects.equals(internalScore, that.internalScore) &&
Objects.equals(externalScore, that.externalScore) &&
Objects.equals(submissionDate, that.submissionDate) &&
Objects.equals(teamMemberId, that.teamMemberId) &&
Objects.equals(internalFeelings, that.internalFeelings) &&
Expand All @@ -100,16 +166,17 @@ public boolean equals(Object o) {
public String toString() {
return "PulseResponse{" +
"id=" + id +
", internalScore" + internalScore +
", externalScore" + externalScore +
", submissionDate=" + submissionDate +
", updatedDate=" + updatedDate +
", teamMemberId=" + teamMemberId +
", internalFeelings=" + internalFeelings +
", externalFeelings=" + externalFeelings +
'}';
}
@Override
public int hashCode() {
return Objects.hash(id, submissionDate, updatedDate, teamMemberId, internalFeelings, externalFeelings);
return Objects.hash(id, internalScore, externalScore, submissionDate, teamMemberId, internalFeelings, externalFeelings);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ public Mono<HttpResponse<Set<PulseResponse>>> findPulseResponses(@Nullable @Form
@Post()
public Mono<HttpResponse<PulseResponse>> createPulseResponse(@Body @Valid PulseResponseCreateDTO pulseResponse,
HttpRequest<?> request) {
return Mono.fromCallable(() -> pulseResponseServices.save(new PulseResponse(pulseResponse.getSubmissionDate(),
pulseResponse.getUpdatedDate(), pulseResponse.getTeamMemberId(), pulseResponse.getInternalFeelings(),
pulseResponse.getExternalFeelings())))
return Mono.fromCallable(() -> pulseResponseServices.save(new PulseResponse(pulseResponse.getInternalScore(), pulseResponse.getExternalScore(), pulseResponse.getSubmissionDate(), pulseResponse.getTeamMemberId(), pulseResponse.getInternalFeelings(), pulseResponse.getExternalFeelings())))
.map(pulseresponse -> HttpResponse.created(pulseresponse)
.headers(headers -> headers.location(URI.create(String.format("%s/%s", request.getPath(),
pulseresponse.getId())))));
.headers(headers -> headers.location(URI.create(String.format("%s/%s", request.getPath(), pulseresponse.getId()))))
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.objectcomputing.checkins.services.pulseresponse;

import io.micronaut.core.annotation.Introspected;
import io.micronaut.core.annotation.Nullable;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
Expand All @@ -15,23 +16,74 @@
public class PulseResponseCreateDTO {

@NotNull
@Schema(description = "date for submissionDate")
private LocalDate submissionDate;
@Schema(required = true, description = "integer value of internal score")
private Integer internalScore;

@Nullable
@Schema(description = "integer value of external score")
private Integer externalScore;

@NotNull
@Schema(description = "date for updatedDate")
private LocalDate updatedDate;
@Schema(description = "date for submissionDate")
private LocalDate submissionDate;

@NotNull
@Schema(description = "id of the associated member")
private UUID teamMemberId;

@NotNull
@Nullable
@Schema(description = "description of internal feelings")
private String internalFeelings;

@NotNull
@Nullable
@Schema(description = "description of external feelings")
private String externalFeelings;

public Integer getInternalScore() {
return internalScore;
}

public void setInternalScore(Integer internalScore) {
this.internalScore = internalScore;
}

public Integer getExternalScore() {
return externalScore;
}

public void setExternalScore(Integer externalScore) {
this.externalScore = externalScore;
}

public LocalDate getSubmissionDate() {
return submissionDate;
}

public void setSubmissionDate(LocalDate submissionDate) {
this.submissionDate = submissionDate;
}

public UUID getTeamMemberId() {
return teamMemberId;
}

public void setTeamMemberId(UUID teamMemberId) {
this.teamMemberId = teamMemberId;
}

public String getInternalFeelings() {
return internalFeelings;
}

public void setInternalFeelings(String internalFeelings) {
this.internalFeelings = internalFeelings;
}

public String getExternalFeelings() {
return externalFeelings;
}

public void setExternalFeelings(String externalFeelings) {
this.externalFeelings = externalFeelings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ public PulseResponse save(PulseResponse pulseResponse) {
if(pulseResponse!=null){
final UUID memberId = pulseResponse.getTeamMemberId();
LocalDate pulseSubDate = pulseResponse.getSubmissionDate();
LocalDate pulseUpDate = pulseResponse.getUpdatedDate();
if(pulseResponse.getId()!=null){
throw new BadArgException(String.format("Found unexpected id for pulseresponse %s", pulseResponse.getId()));
} else if(!memberRepo.findById(memberId).isPresent()){
throw new BadArgException(String.format("Member %s doesn't exists", memberId));
} else if(pulseSubDate.isBefore(LocalDate.EPOCH) || pulseSubDate.isAfter(LocalDate.MAX)) {
throw new BadArgException(String.format("Invalid date for pulseresponse submission date %s",memberId));
} else if(pulseUpDate.isBefore(LocalDate.EPOCH) || pulseUpDate.isAfter(LocalDate.MAX)) {
throw new BadArgException(String.format("Invalid date for pulseresponse updated date %s",memberId));
}
pulseResponseRet = pulseResponseRepo.save(pulseResponse);
}
Expand All @@ -56,7 +53,6 @@ public PulseResponse update(PulseResponse pulseResponse) {
final UUID id = pulseResponse.getId();
final UUID memberId = pulseResponse.getTeamMemberId();
LocalDate pulseSubDate = pulseResponse.getSubmissionDate();
LocalDate pulseUpDate = pulseResponse.getUpdatedDate();
if(id==null||!pulseResponseRepo.findById(id).isPresent()){
throw new BadArgException(String.format("Unable to find pulseresponse record with id %s", pulseResponse.getId()));
}else if(!memberRepo.findById(memberId).isPresent()){
Expand All @@ -65,8 +61,6 @@ public PulseResponse update(PulseResponse pulseResponse) {
throw new BadArgException(String.format("Invalid pulseresponse %s", pulseResponse));
} else if(pulseSubDate.isBefore(LocalDate.EPOCH) || pulseSubDate.isAfter(LocalDate.MAX)) {
throw new BadArgException(String.format("Invalid date for pulseresponse submission date %s",memberId));
} else if(pulseUpDate.isBefore(LocalDate.EPOCH) || pulseUpDate.isAfter(LocalDate.MAX)) {
throw new BadArgException(String.format("Invalid date for pulseresponse %s",memberId));
}

pulseResponseRet = pulseResponseRepo.update(pulseResponse);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE pulse_response DROP COLUMN updatedDate;

ALTER TABLE pulse_response ADD COLUMN internal_score Integer;
ALTER TABLE pulse_response ADD COLUMN external_score Integer;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public interface PulseResponseFixture extends RepositoryFixture {
default PulseResponse createADefaultPulseResponse(MemberProfile memberprofile) {
return getPulseResponseRepository().save(new PulseResponse(LocalDate.now(), LocalDate.now(),
return getPulseResponseRepository().save(new PulseResponse(0, 0, LocalDate.now(),
memberprofile.getId(), "internalfeelings", "externalfeelings"));
}
}
Loading