From 88621b1258a4dd7f1b29c942aaaa49c31aa86a3e Mon Sep 17 00:00:00 2001 From: Alec M Date: Thu, 5 Dec 2024 10:59:49 -0500 Subject: [PATCH] Remove `organization` from Application type --- src/components/Contexts/FormContext.test.tsx | 8 ++------ src/components/Contexts/FormContext.tsx | 1 - src/config/InitialValues.ts | 1 - .../questionnaire/Contexts/QuestionnaireContext.tsx | 5 ++++- src/graphql/getApplication.ts | 4 ---- src/graphql/listApplications.ts | 2 +- src/graphql/reviewApplication.ts | 5 +---- src/graphql/saveApplication.ts | 4 ---- src/types/Application.d.ts | 1 - src/utils/formModeUtils.test.ts | 4 ---- 10 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/components/Contexts/FormContext.test.tsx b/src/components/Contexts/FormContext.test.tsx index d3ef819d1..dd7cd8785 100644 --- a/src/components/Contexts/FormContext.test.tsx +++ b/src/components/Contexts/FormContext.test.tsx @@ -16,7 +16,6 @@ import { REOPEN_APP, RejectAppResp, ReopenAppResp, - ReviewAppResp, } from "../../graphql"; const baseApplication: Omit = { @@ -35,10 +34,6 @@ const baseApplication: Omit = { applicantName: "", applicantEmail: "", }, - organization: { - _id: "", - name: "", - }, programName: "", studyAbbreviation: "", conditional: false, @@ -885,7 +880,8 @@ describe("reopenForm Tests", () => { data: { reopenApplication: { _id: "mock-reopen-id", - } as ReviewAppResp["reviewApplication"], + status: "In Progress", + } as ReopenAppResp["reopenApplication"], }, }, }; diff --git a/src/components/Contexts/FormContext.tsx b/src/components/Contexts/FormContext.tsx index 8cb969164..70493ef16 100644 --- a/src/components/Contexts/FormContext.tsx +++ b/src/components/Contexts/FormContext.tsx @@ -185,7 +185,6 @@ export const FormProvider: FC = ({ children, id }: ProviderProps) ...newState.data, _id: d.saveApplication["_id"], applicant: d?.saveApplication?.applicant, - organization: d?.saveApplication?.organization, }; } diff --git a/src/config/InitialValues.ts b/src/config/InitialValues.ts index c52d205bf..0dd34d2c3 100644 --- a/src/config/InitialValues.ts +++ b/src/config/InitialValues.ts @@ -1,7 +1,6 @@ export const InitialApplication: Omit = { _id: "new", applicant: null, - organization: null, status: "New", createdAt: "", updatedAt: "", diff --git a/src/content/questionnaire/Contexts/QuestionnaireContext.tsx b/src/content/questionnaire/Contexts/QuestionnaireContext.tsx index 82243e873..688efece2 100644 --- a/src/content/questionnaire/Contexts/QuestionnaireContext.tsx +++ b/src/content/questionnaire/Contexts/QuestionnaireContext.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { ListApplicationsResp } from "../../../graphql"; const QuestionnaireContext = React.createContext<{ /** @@ -8,7 +9,9 @@ const QuestionnaireContext = React.createContext<{ /** * Action performed when 'Review' button is clicked */ - handleOnReviewClick?: (application: Omit) => void; + handleOnReviewClick?: ( + application: ListApplicationsResp["listApplications"]["applications"][number] + ) => void; }>({}); export default QuestionnaireContext; diff --git a/src/graphql/getApplication.ts b/src/graphql/getApplication.ts index f35964324..a2fff55b4 100644 --- a/src/graphql/getApplication.ts +++ b/src/graphql/getApplication.ts @@ -21,10 +21,6 @@ export const query = gql` applicantID applicantName } - organization { - _id - name - } programName studyAbbreviation questionnaireData diff --git a/src/graphql/listApplications.ts b/src/graphql/listApplications.ts index da5c41a12..8d309e63b 100644 --- a/src/graphql/listApplications.ts +++ b/src/graphql/listApplications.ts @@ -38,6 +38,6 @@ export type Input = { export type Response = { listApplications: { total: number; - applications: Omit[]; + applications: Omit[]; }; }; diff --git a/src/graphql/reviewApplication.ts b/src/graphql/reviewApplication.ts index 77dde7fc4..06d09ed6d 100644 --- a/src/graphql/reviewApplication.ts +++ b/src/graphql/reviewApplication.ts @@ -14,8 +14,5 @@ export type Input = { }; export type Response = { - reviewApplication: Pick< - Application, - "_id" | "status" | "createdAt" | "updatedAt" | "history" | "applicant" - >; + reviewApplication: Pick; }; diff --git a/src/graphql/saveApplication.ts b/src/graphql/saveApplication.ts index 1a895668f..a3795790b 100644 --- a/src/graphql/saveApplication.ts +++ b/src/graphql/saveApplication.ts @@ -22,10 +22,6 @@ export const mutation = gql` applicantID applicantName } - organization { - _id - name - } } } `; diff --git a/src/types/Application.d.ts b/src/types/Application.d.ts index 4de3a82ec..f5c296493 100644 --- a/src/types/Application.d.ts +++ b/src/types/Application.d.ts @@ -9,7 +9,6 @@ type Application = { ORCID: string; // Applicant Details applicant: Applicant; - organization: Pick; PI: string; // Principal Investigator's full name " " controlledAccess: boolean; openAccess: boolean; diff --git a/src/utils/formModeUtils.test.ts b/src/utils/formModeUtils.test.ts index 8c45a7807..2c025a006 100644 --- a/src/utils/formModeUtils.test.ts +++ b/src/utils/formModeUtils.test.ts @@ -28,10 +28,6 @@ describe("getFormMode tests based on provided requirements", () => { _id: "submission-123", questionnaireData: InitialQuestionnaire, status: "New", - organization: { - _id: baseUser.organization.orgID, - name: baseUser.organization.orgName, - }, applicant: { applicantID: baseUser._id, applicantName: baseUser.firstName,