Skip to content

Commit

Permalink
updateTimeOfTest --> AoeQuestions pt 1 (#7801)
Browse files Browse the repository at this point in the history
* add in rename

* run codegen

* lint

* add back in accidental deletion

* add test result delivery
  • Loading branch information
fzhao99 authored Jun 14, 2024
1 parent b78554a commit 7556f36
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,34 @@ public void updateTimeOfTestQuestions(

Map<String, Boolean> symptomsMap = parseSymptoms(symptoms);

testOrderService.updateTimeOfTestQuestions(
testOrderService.updateAoeQuestions(
patientId,
pregnancy,
syphilisHistory,
symptomsMap,
symptomOnset,
noSymptoms,
genderOfSexualPartners);

if (testResultDelivery != null) {
personService.updateTestResultDeliveryPreference(patientId, testResultDelivery);
}
}

@MutationMapping
public void updateAoeQuestions(
@Argument UUID patientId,
@Argument String pregnancy,
@Argument String syphilisHistory,
@Argument String symptoms,
@Argument LocalDate symptomOnset,
@Argument Boolean noSymptoms,
@Argument List<String> genderOfSexualPartners,
@Argument TestResultDeliveryPreference testResultDelivery) {

Map<String, Boolean> symptomsMap = parseSymptoms(symptoms);

testOrderService.updateAoeQuestions(
patientId,
pregnancy,
syphilisHistory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public TestOrder addPatientToQueue(
}

@AuthorizationConfiguration.RequirePermissionUpdateTestForPatient
public void updateTimeOfTestQuestions(
public void updateAoeQuestions(
UUID patientId,
String pregnancy,
String syphilisHistory,
Expand Down
10 changes: 10 additions & 0 deletions backend/src/main/resources/graphql/main.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,16 @@ type Mutation {
genderOfSexualPartners: [String]
testResultDelivery: TestResultDeliveryPreference
): String @requiredPermissions(allOf: ["UPDATE_TEST"])
updateAoeQuestions(
patientId: ID!
pregnancy: String
syphilisHistory: String
symptoms: String @Size(min: 0, max: 1024)
symptomOnset: LocalDate
noSymptoms: Boolean
genderOfSexualPartners: [String]
testResultDelivery: TestResultDeliveryPreference
): String @requiredPermissions(allOf: ["UPDATE_TEST"])
sendPatientLinkSms(internalId: ID!): Boolean
@requiredPermissions(allOf: ["UPDATE_TEST"])
sendPatientLinkSmsByTestEventId(testEventId: ID!): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ void queueOperations_standardUser_successDependsOnFacilityAccess() throws Except
performQueueUpdateMutation(updateVariables, Optional.empty());

updateSelfPrivileges(Role.USER, false, Set.of(_secondSite.getInternalId()));
// updateTimeOfTestQuestions uses the exact same security restrictions
// updateAoeQuestions uses the exact same security restrictions
Map<String, Object> removeVariables = Map.of("patientId", personId.toString());
performRemoveFromQueueMutation(removeVariables, Optional.of(ACCESS_ERROR));
updateSelfPrivileges(Role.USER, false, Set.of(_site.getInternalId()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mutation UpdateAOE(
$patientId: ID!
$symptoms: String
$symptomOnset: LocalDate
$pregnancy: String
$syphilisHistory: String
$noSymptoms: Boolean
$genderOfSexualPartners: [String]
$testResultDelivery: TestResultDeliveryPreference
) {
updateAoeQuestions(
patientId: $patientId
pregnancy: $pregnancy
syphilisHistory: $syphilisHistory
symptoms: $symptoms
noSymptoms: $noSymptoms
symptomOnset: $symptomOnset
genderOfSexualPartners: $genderOfSexualPartners
testResultDelivery: $testResultDelivery
)
}
14 changes: 14 additions & 0 deletions frontend/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export type Mutation = {
setRegistrationLinkIsDeleted?: Maybe<Scalars["String"]["output"]>;
setUserIsDeleted?: Maybe<User>;
submitQueueItem?: Maybe<AddTestResultResponse>;
updateAoeQuestions?: Maybe<Scalars["String"]["output"]>;
updateDeviceType?: Maybe<DeviceType>;
updateFacility?: Maybe<Facility>;
updateFeatureFlag?: Maybe<FeatureFlag>;
Expand Down Expand Up @@ -466,6 +467,19 @@ export type MutationSubmitQueueItemArgs = {
specimenTypeId: Scalars["ID"]["input"];
};

export type MutationUpdateAoeQuestionsArgs = {
genderOfSexualPartners?: InputMaybe<
Array<InputMaybe<Scalars["String"]["input"]>>
>;
noSymptoms?: InputMaybe<Scalars["Boolean"]["input"]>;
patientId: Scalars["ID"]["input"];
pregnancy?: InputMaybe<Scalars["String"]["input"]>;
symptomOnset?: InputMaybe<Scalars["LocalDate"]["input"]>;
symptoms?: InputMaybe<Scalars["String"]["input"]>;
syphilisHistory?: InputMaybe<Scalars["String"]["input"]>;
testResultDelivery?: InputMaybe<TestResultDeliveryPreference>;
};

export type MutationUpdateDeviceTypeArgs = {
input: UpdateDeviceType;
};
Expand Down

0 comments on commit 7556f36

Please sign in to comment.