From e0e7b84139bd537ee62462efc6debde68e2623da Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Wed, 31 Jan 2024 15:44:03 +0000 Subject: [PATCH] refactor(frontend): update create_project json structure --- .../src/components/createnewproject/SplitTasks.tsx | 13 +++---------- .../src/components/createproject/FormSelection.tsx | 14 +++----------- .../src/models/createproject/createProjectModel.ts | 4 ---- src/frontend/src/store/types/ICreateProject.ts | 5 ----- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/src/frontend/src/components/createnewproject/SplitTasks.tsx b/src/frontend/src/components/createnewproject/SplitTasks.tsx index 228481a9ef..1b01470395 100644 --- a/src/frontend/src/components/createnewproject/SplitTasks.tsx +++ b/src/frontend/src/components/createnewproject/SplitTasks.tsx @@ -45,7 +45,6 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo const drawnGeojson = CoreModules.useAppSelector((state) => state.createproject.drawnGeojson); const projectDetails = CoreModules.useAppSelector((state) => state.createproject.projectDetails); const dataExtractGeojson = useAppSelector((state) => state.createproject.dataExtractGeojson); - const userDetails: any = CoreModules.useAppSelector((state) => state.login.loginToken); const generateQrSuccess: any = CoreModules.useAppSelector((state) => state.createproject.generateQrSuccess); const projectDetailsResponse = CoreModules.useAppSelector((state) => state.createproject.projectDetailsResponse); @@ -109,15 +108,9 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo short_description: projectDetails.short_description, description: projectDetails.description, }, - author: { - username: userDetails.username, - id: userDetails.id, - }, - odk_central: { - odk_central_url: projectDetails.odk_central_url, - odk_central_user: projectDetails.odk_central_user, - odk_central_password: projectDetails.odk_central_password, - }, + odk_central_url: projectDetails.odk_central_url, + odk_central_user: projectDetails.odk_central_user, + odk_central_password: projectDetails.odk_central_password, // dont send xform_title if upload custom form is selected xform_title: projectDetails.formCategorySelection, task_split_type: splitTasksSelection, diff --git a/src/frontend/src/components/createproject/FormSelection.tsx b/src/frontend/src/components/createproject/FormSelection.tsx index c348b7782c..be5d91d6d5 100755 --- a/src/frontend/src/components/createproject/FormSelection.tsx +++ b/src/frontend/src/components/createproject/FormSelection.tsx @@ -40,8 +40,6 @@ const FormSelection: React.FC = ({ const selectFormWaysList = ['Use Existing Category', 'Upload a Custom Form']; const selectFormWays = selectFormWaysList.map((item) => ({ label: item, value: item })); - const userDetails: any = CoreModules.useAppSelector((state) => state.login.loginToken); - // //we use use-selector from redux to get all state of loginToken from login slice const generateProjectLog: any = CoreModules.useAppSelector((state) => state.createproject.generateProjectLog); // //we use use-selector from redux to get all state of loginToken from login slice @@ -81,15 +79,9 @@ const FormSelection: React.FC = ({ short_description: projectDetails.short_description, description: projectDetails.description, }, - author: { - username: userDetails?.username || 'svcfmtm', - id: userDetails?.id || 20386219, - }, - odk_central: { - odk_central_url: projectDetails.odk_central_url, - odk_central_user: projectDetails.odk_central_user, - odk_central_password: projectDetails.odk_central_password, - }, + odk_central_url: projectDetails.odk_central_url, + odk_central_user: projectDetails.odk_central_user, + odk_central_password: projectDetails.odk_central_password, // dont send xform_title if upload custom form is selected xform_title: projectDetails.form_ways === 'Upload a Form' ? null : projectDetails.xform_title, dimension: projectDetails.dimension, diff --git a/src/frontend/src/models/createproject/createProjectModel.ts b/src/frontend/src/models/createproject/createProjectModel.ts index 1c78c11d86..11c0d5f6d2 100755 --- a/src/frontend/src/models/createproject/createProjectModel.ts +++ b/src/frontend/src/models/createproject/createProjectModel.ts @@ -1,10 +1,6 @@ export interface ProjectDetailsModel { id: number; odkid: number; - author: { - username: string; - id: number; - }; default_locale: string; project_info: { locale: string; diff --git a/src/frontend/src/store/types/ICreateProject.ts b/src/frontend/src/store/types/ICreateProject.ts index adfd719988..ce1200a5d8 100644 --- a/src/frontend/src/store/types/ICreateProject.ts +++ b/src/frontend/src/store/types/ICreateProject.ts @@ -40,10 +40,6 @@ export type CreateProjectStateTypes = { export type ValidateCustomFormResponse = { detail: { message: string; possible_reason: string }; }; -export type AuthorTypes = { - username: string; - id: number; -}; export type GeometryTypes = { type: string; @@ -82,7 +78,6 @@ export type ProjectInfoTypes = { type EditProjectResponseTypes = { id: number; odkid: number; - author: AuthorTypes; project_info: ProjectInfoTypes[]; status: number; outline_geojson: GeoJSONFeatureTypes;