Skip to content

Commit

Permalink
Remove organization from Application type
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Dec 5, 2024
1 parent b271761 commit 88621b1
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 27 deletions.
8 changes: 2 additions & 6 deletions src/components/Contexts/FormContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
REOPEN_APP,
RejectAppResp,
ReopenAppResp,
ReviewAppResp,
} from "../../graphql";

const baseApplication: Omit<Application, "questionnaireData"> = {
Expand All @@ -35,10 +34,6 @@ const baseApplication: Omit<Application, "questionnaireData"> = {
applicantName: "",
applicantEmail: "",
},
organization: {
_id: "",
name: "",
},
programName: "",
studyAbbreviation: "",
conditional: false,
Expand Down Expand Up @@ -885,7 +880,8 @@ describe("reopenForm Tests", () => {
data: {
reopenApplication: {
_id: "mock-reopen-id",
} as ReviewAppResp["reviewApplication"],
status: "In Progress",
} as ReopenAppResp["reopenApplication"],
},
},
};
Expand Down
1 change: 0 additions & 1 deletion src/components/Contexts/FormContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ export const FormProvider: FC<ProviderProps> = ({ children, id }: ProviderProps)
...newState.data,
_id: d.saveApplication["_id"],
applicant: d?.saveApplication?.applicant,
organization: d?.saveApplication?.organization,
};
}

Expand Down
1 change: 0 additions & 1 deletion src/config/InitialValues.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const InitialApplication: Omit<Application, "questionnaireData"> = {
_id: "new",
applicant: null,
organization: null,
status: "New",
createdAt: "",
updatedAt: "",
Expand Down
5 changes: 4 additions & 1 deletion src/content/questionnaire/Contexts/QuestionnaireContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { ListApplicationsResp } from "../../../graphql";

const QuestionnaireContext = React.createContext<{
/**
Expand All @@ -8,7 +9,9 @@ const QuestionnaireContext = React.createContext<{
/**
* Action performed when 'Review' button is clicked
*/
handleOnReviewClick?: (application: Omit<Application, "questionnaireData">) => void;
handleOnReviewClick?: (
application: ListApplicationsResp["listApplications"]["applications"][number]
) => void;
}>({});

export default QuestionnaireContext;
4 changes: 0 additions & 4 deletions src/graphql/getApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export const query = gql`
applicantID
applicantName
}
organization {
_id
name
}
programName
studyAbbreviation
questionnaireData
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/listApplications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export type Input = {
export type Response = {
listApplications: {
total: number;
applications: Omit<Application, "questionnaireData" | "organization">[];
applications: Omit<Application, "questionnaireData">[];
};
};
5 changes: 1 addition & 4 deletions src/graphql/reviewApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ export type Input = {
};

export type Response = {
reviewApplication: Pick<
Application,
"_id" | "status" | "createdAt" | "updatedAt" | "history" | "applicant"
>;
reviewApplication: Pick<Application, "_id" | "status">;
};
4 changes: 0 additions & 4 deletions src/graphql/saveApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const mutation = gql`
applicantID
applicantName
}
organization {
_id
name
}
}
}
`;
Expand Down
1 change: 0 additions & 1 deletion src/types/Application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ type Application = {
ORCID: string;
// Applicant Details
applicant: Applicant;
organization: Pick<Organization, "_id" | "name">;
PI: string; // Principal Investigator's full name "<first name> <last name>"
controlledAccess: boolean;
openAccess: boolean;
Expand Down
4 changes: 0 additions & 4 deletions src/utils/formModeUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 88621b1

Please sign in to comment.