From 2f898396895139e9a7baa4cffc07815a6834aa77 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Fri, 27 Oct 2023 11:22:45 -0700 Subject: [PATCH 01/12] added required tag to site selection form and open api spec --- api/src/paths/project/{projectId}/survey/create.ts | 1 + .../paths/project/{projectId}/survey/{surveyId}/update.ts | 1 + .../surveys/components/SurveySiteSelectionForm.tsx | 8 +++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/src/paths/project/{projectId}/survey/create.ts b/api/src/paths/project/{projectId}/survey/create.ts index 424e13f02e..c8feae1725 100644 --- a/api/src/paths/project/{projectId}/survey/create.ts +++ b/api/src/paths/project/{projectId}/survey/create.ts @@ -245,6 +245,7 @@ POST.apiDoc = { properties: { strategies: { type: 'array', + minItems: 1, items: { type: 'string' } diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts index 2cb9c2648f..0a70c97f38 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts @@ -280,6 +280,7 @@ PUT.apiDoc = { properties: { strategies: { type: 'array', + minItems: 1, items: { type: 'string' } diff --git a/app/src/features/surveys/components/SurveySiteSelectionForm.tsx b/app/src/features/surveys/components/SurveySiteSelectionForm.tsx index a66fe5161d..5d739a2f16 100644 --- a/app/src/features/surveys/components/SurveySiteSelectionForm.tsx +++ b/app/src/features/surveys/components/SurveySiteSelectionForm.tsx @@ -31,7 +31,9 @@ export const SurveySiteSelectionYupSchema = yup.object().shape({ site_selection: yup.object().shape({ strategies: yup .array() - .of(yup.string() /* .required('Must select a valid site selection strategy') */) + .required('Must select a valid site selection strategy') + .min(1, 'Must select a valid site selection strategy') + .of(yup.string()) .when('stratums', (stratums: string[], schema: any) => { return stratums.length > 0 ? schema.test( @@ -130,8 +132,8 @@ const SurveySiteSelectionForm = (props: ISurveySiteSelectionFormProps) => { label="Site Selection Strategies" options={siteStrategies} selectedOptions={selectedSiteStrategies} - required={false} - onChange={(event, selectedOptions, reason) => { + required={true} + onChange={(_, selectedOptions, reason) => { // If the user clicks to remove the 'Stratified' option and there are Stratums already defined, then show // a warning dialogue asking the user if they are sure they want to remove the option and delete the Stratums if ( From b9ef573913d482eee37d0292bb7ab1cd1245c0e4 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Fri, 27 Oct 2023 12:11:36 -0700 Subject: [PATCH 02/12] removed references to field method from survey --- .../paths/project/{projectId}/survey/create.ts | 3 ++- api/src/paths/project/{projectId}/survey/list.ts | 4 ++-- .../{projectId}/survey/{surveyId}/update.ts | 4 ++-- .../{projectId}/survey/{surveyId}/update/get.ts | 3 ++- .../project/{projectId}/survey/{surveyId}/view.ts | 3 ++- app/src/features/surveys/CreateSurveyPage.tsx | 5 ----- .../components/PurposeAndMethodologyForm.tsx | 15 ++------------- app/src/features/surveys/edit/EditSurveyForm.tsx | 5 ----- .../SurveyPurposeAndMethodologyData.tsx | 9 --------- 9 files changed, 12 insertions(+), 39 deletions(-) diff --git a/api/src/paths/project/{projectId}/survey/create.ts b/api/src/paths/project/{projectId}/survey/create.ts index c8feae1725..eb895455ba 100644 --- a/api/src/paths/project/{projectId}/survey/create.ts +++ b/api/src/paths/project/{projectId}/survey/create.ts @@ -202,7 +202,8 @@ POST.apiDoc = { type: 'string' }, field_method_id: { - type: 'number' + type: 'number', + nullable: true }, vantage_code_ids: { type: 'array', diff --git a/api/src/paths/project/{projectId}/survey/list.ts b/api/src/paths/project/{projectId}/survey/list.ts index c585548b4a..027cc2f9dd 100644 --- a/api/src/paths/project/{projectId}/survey/list.ts +++ b/api/src/paths/project/{projectId}/survey/list.ts @@ -171,7 +171,6 @@ GET.apiDoc = { description: 'Survey Details', type: 'object', required: [ - 'field_method_id', 'additional_details', 'intended_outcome_id', 'ecological_season_id', @@ -180,7 +179,8 @@ GET.apiDoc = { ], properties: { field_method_id: { - type: 'number' + type: 'number', + nullable: true }, additional_details: { type: 'string', diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts index 0a70c97f38..a6c44ced0e 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts @@ -213,7 +213,6 @@ PUT.apiDoc = { required: [ 'intended_outcome_id', 'additional_details', - 'field_method_id', 'vantage_code_ids', 'ecological_season_id', 'revision_count' @@ -226,7 +225,8 @@ PUT.apiDoc = { type: 'string' }, field_method_id: { - type: 'number' + type: 'number', + nullable: true }, vantage_code_ids: { type: 'array', diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts index 18ca7576ba..af2fc64876 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts @@ -219,7 +219,8 @@ GET.apiDoc = { ], properties: { field_method_id: { - type: 'number' + type: 'number', + nullable: true }, additional_details: { type: 'string', diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts index 6b3d466ddf..2cc54d8bca 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts @@ -240,7 +240,8 @@ GET.apiDoc = { ], properties: { field_method_id: { - type: 'number' + type: 'number', + nullable: true }, additional_details: { type: 'string', diff --git a/app/src/features/surveys/CreateSurveyPage.tsx b/app/src/features/surveys/CreateSurveyPage.tsx index 45e1b0711b..94d7ca6762 100644 --- a/app/src/features/surveys/CreateSurveyPage.tsx +++ b/app/src/features/surveys/CreateSurveyPage.tsx @@ -334,11 +334,6 @@ const CreateSurveyPage = () => { return { value: item.id, label: item.name, subText: item.description }; }) || [] } - field_methods={ - codes?.field_methods.map((item) => { - return { value: item.id, label: item.name, subText: item.description }; - }) || [] - } ecological_seasons={ codes?.ecological_seasons.map((item) => { return { value: item.id, label: item.name, subText: item.description }; diff --git a/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx b/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx index 0bd153a960..6626e9ec63 100644 --- a/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx +++ b/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx @@ -13,7 +13,7 @@ export interface IPurposeAndMethodologyForm { purpose_and_methodology: { intended_outcome_id: number; additional_details: string; - field_method_id: number; + field_method_id: number | null; ecological_season_id: number; vantage_code_ids: number[]; }; @@ -23,7 +23,7 @@ export const PurposeAndMethodologyInitialValues: IPurposeAndMethodologyForm = { purpose_and_methodology: { intended_outcome_id: '' as unknown as number, additional_details: '', - field_method_id: '' as unknown as number, + field_method_id: null, ecological_season_id: '' as unknown as number, vantage_code_ids: [] } @@ -31,7 +31,6 @@ export const PurposeAndMethodologyInitialValues: IPurposeAndMethodologyForm = { export const PurposeAndMethodologyYupSchema = yup.object().shape({ purpose_and_methodology: yup.object().shape({ - field_method_id: yup.number().required('Field Method is Required'), additional_details: yup.string(), intended_outcome_id: yup.number().required('Intended Outcome is Required'), ecological_season_id: yup.number().required('Ecological Season is Required'), @@ -41,7 +40,6 @@ export const PurposeAndMethodologyYupSchema = yup.object().shape({ export interface IPurposeAndMethodologyFormProps { intended_outcomes: ISelectWithSubtextFieldOption[]; - field_methods: ISelectWithSubtextFieldOption[]; ecological_seasons: ISelectWithSubtextFieldOption[]; vantage_codes: IMultiAutocompleteFieldOption[]; } @@ -82,15 +80,6 @@ const PurposeAndMethodologyForm: React.FC = (pr Survey Methodology - - - = (props) => { return { value: item.id, label: item.name, subText: item.description }; }) || [] } - field_methods={ - props.codes.field_methods.map((item) => { - return { value: item.id, label: item.name, subText: item.description }; - }) || [] - } ecological_seasons={ props.codes.ecological_seasons.map((item) => { return { value: item.id, label: item.name, subText: item.description }; diff --git a/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.tsx b/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.tsx index 91e0ecfe4a..839c72244b 100644 --- a/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.tsx +++ b/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.tsx @@ -44,15 +44,6 @@ const SurveyPurposeAndMethodologyData = () => { )} - - Field Method - - {Boolean(surveyData.purpose_and_methodology.field_method_id) && - codes?.field_methods?.find((item: any) => item.id === surveyData.purpose_and_methodology.field_method_id) - ?.name} - - - Ecological Season From c2ff9ae808814acb8782599083acf6d963e88e01 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Fri, 27 Oct 2023 14:36:03 -0700 Subject: [PATCH 03/12] fixing code smells --- api/src/utils/xlsx-utils/worksheet-utils.ts | 2 +- .../surveys/view/components/SurveyGeneralInformation.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/utils/xlsx-utils/worksheet-utils.ts b/api/src/utils/xlsx-utils/worksheet-utils.ts index 0d18554327..c2c62c9c13 100644 --- a/api/src/utils/xlsx-utils/worksheet-utils.ts +++ b/api/src/utils/xlsx-utils/worksheet-utils.ts @@ -254,7 +254,7 @@ export function prepareWorksheetCells(worksheet: xlsx.WorkSheet) { const coord = xlsx.utils.encode_cell({ r, c }); let cell: CellObject = worksheet[coord]; - if (!cell || !cell.v) { + if (!cell?.v) { // Cell is null or has no raw value continue; } diff --git a/app/src/features/surveys/view/components/SurveyGeneralInformation.tsx b/app/src/features/surveys/view/components/SurveyGeneralInformation.tsx index a7bcecf9ef..74358ac65c 100644 --- a/app/src/features/surveys/view/components/SurveyGeneralInformation.tsx +++ b/app/src/features/surveys/view/components/SurveyGeneralInformation.tsx @@ -66,7 +66,7 @@ const SurveyGeneralInformation = () => { return ( { return ( Date: Mon, 30 Oct 2023 14:02:39 -0700 Subject: [PATCH 04/12] removing field method from open api, depreciating table --- .../project/{projectId}/survey/create.ts | 4 ---- .../{projectId}/survey/{surveyId}/update.ts | 4 ---- .../{projectId}/survey/{surveyId}/view.ts | 5 ----- .../20231030120000_depreciate_field_method.ts | 20 +++++++++++++++++++ 4 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 database/src/migrations/20231030120000_depreciate_field_method.ts diff --git a/api/src/paths/project/{projectId}/survey/create.ts b/api/src/paths/project/{projectId}/survey/create.ts index eb895455ba..175ffbdfc7 100644 --- a/api/src/paths/project/{projectId}/survey/create.ts +++ b/api/src/paths/project/{projectId}/survey/create.ts @@ -201,10 +201,6 @@ POST.apiDoc = { additional_details: { type: 'string' }, - field_method_id: { - type: 'number', - nullable: true - }, vantage_code_ids: { type: 'array', items: { diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts index a6c44ced0e..41238f30b1 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts @@ -224,10 +224,6 @@ PUT.apiDoc = { additional_details: { type: 'string' }, - field_method_id: { - type: 'number', - nullable: true - }, vantage_code_ids: { type: 'array', items: { diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts index 2cc54d8bca..c00bf9742b 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts @@ -231,7 +231,6 @@ GET.apiDoc = { description: 'Survey Details', type: 'object', required: [ - 'field_method_id', 'additional_details', 'intended_outcome_id', 'ecological_season_id', @@ -239,10 +238,6 @@ GET.apiDoc = { 'revision_count' ], properties: { - field_method_id: { - type: 'number', - nullable: true - }, additional_details: { type: 'string', nullable: true diff --git a/database/src/migrations/20231030120000_depreciate_field_method.ts b/database/src/migrations/20231030120000_depreciate_field_method.ts new file mode 100644 index 0000000000..bbacc6cec5 --- /dev/null +++ b/database/src/migrations/20231030120000_depreciate_field_method.ts @@ -0,0 +1,20 @@ +import { Knex } from 'knex'; + +/** + * + * @export + * @param {Knex} knex + * @return {*} {Promise} + */ +export async function up(knex: Knex): Promise { + await knex.raw(`--sql + SET search_path = 'biohub'; + + COMMENT ON TABLE field_method IS ''; + COMMENT ON COLUMN survey.field_method_id IS ''; + `); +} + +export async function down(knex: Knex): Promise { + await knex.raw(``); +} From 079d67c6dc31ddddb538924c870a313f388cb2f0 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Mon, 30 Oct 2023 14:07:07 -0700 Subject: [PATCH 05/12] added depreciation tags to table and column --- .../src/migrations/20231030120000_depreciate_field_method.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/src/migrations/20231030120000_depreciate_field_method.ts b/database/src/migrations/20231030120000_depreciate_field_method.ts index bbacc6cec5..d677308a71 100644 --- a/database/src/migrations/20231030120000_depreciate_field_method.ts +++ b/database/src/migrations/20231030120000_depreciate_field_method.ts @@ -10,8 +10,8 @@ export async function up(knex: Knex): Promise { await knex.raw(`--sql SET search_path = 'biohub'; - COMMENT ON TABLE field_method IS ''; - COMMENT ON COLUMN survey.field_method_id IS ''; + COMMENT ON TABLE field_method IS '(Depreciated) A common methodology is a specific species inventory protocol that may be implemented across various species and strata. Examples include Stratified Random Block.'; + COMMENT ON COLUMN survey.field_method_id IS '(Depreciated) System generated surrogate primary key identifier.'; `); } From 13cfbf5b9ae40a1b958f411786c3d6f7240f4f33 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Mon, 30 Oct 2023 14:07:26 -0700 Subject: [PATCH 06/12] clean up --- .../src/migrations/20231030120000_depreciate_field_method.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/database/src/migrations/20231030120000_depreciate_field_method.ts b/database/src/migrations/20231030120000_depreciate_field_method.ts index d677308a71..676cc9c9d1 100644 --- a/database/src/migrations/20231030120000_depreciate_field_method.ts +++ b/database/src/migrations/20231030120000_depreciate_field_method.ts @@ -10,7 +10,6 @@ export async function up(knex: Knex): Promise { await knex.raw(`--sql SET search_path = 'biohub'; - COMMENT ON TABLE field_method IS '(Depreciated) A common methodology is a specific species inventory protocol that may be implemented across various species and strata. Examples include Stratified Random Block.'; COMMENT ON COLUMN survey.field_method_id IS '(Depreciated) System generated surrogate primary key identifier.'; `); } From c220cbae86de31df2314082f8b2e3991f4e4d8f8 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Mon, 30 Oct 2023 14:41:53 -0700 Subject: [PATCH 07/12] removed remaining field methods from open api specs --- api/src/paths/project/{projectId}/survey/list.ts | 4 ---- .../project/{projectId}/survey/{surveyId}/update/get.ts | 5 ----- 2 files changed, 9 deletions(-) diff --git a/api/src/paths/project/{projectId}/survey/list.ts b/api/src/paths/project/{projectId}/survey/list.ts index 027cc2f9dd..ce5efdd0af 100644 --- a/api/src/paths/project/{projectId}/survey/list.ts +++ b/api/src/paths/project/{projectId}/survey/list.ts @@ -178,10 +178,6 @@ GET.apiDoc = { 'revision_count' ], properties: { - field_method_id: { - type: 'number', - nullable: true - }, additional_details: { type: 'string', nullable: true diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts index af2fc64876..6f9271e853 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts @@ -210,7 +210,6 @@ GET.apiDoc = { description: 'Survey Details', type: 'object', required: [ - 'field_method_id', 'additional_details', 'intended_outcome_id', 'ecological_season_id', @@ -218,10 +217,6 @@ GET.apiDoc = { 'revision_count' ], properties: { - field_method_id: { - type: 'number', - nullable: true - }, additional_details: { type: 'string', nullable: true From bc8f6e7d3f7743d3a3602ed19422a3fbd950f5b4 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Mon, 30 Oct 2023 14:42:01 -0700 Subject: [PATCH 08/12] fixed broken test --- .../view/components/SurveyPurposeAndMethodologyData.test.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.test.tsx b/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.test.tsx index f6f6c7d50a..d317b8300b 100644 --- a/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.test.tsx +++ b/app/src/features/surveys/view/components/SurveyPurposeAndMethodologyData.test.tsx @@ -43,7 +43,6 @@ describe('SurveyPurposeAndMethodologyData', () => { ); expect(getByTestId('survey_intended_outcome').textContent).toEqual('Intended Outcome 1'); - expect(getByTestId('survey_field_method').textContent).toEqual('Recruitment'); expect(getByTestId('survey_ecological_season').textContent).toEqual('Season 1'); expect(getAllByTestId('survey_vantage_code').map((item) => item.textContent)).toEqual([ 'Vantage Code 1', @@ -94,7 +93,6 @@ describe('SurveyPurposeAndMethodologyData', () => { ); expect(getByTestId('survey_intended_outcome').textContent).toEqual('Intended Outcome 1'); - expect(getByTestId('survey_field_method').textContent).toEqual('Recruitment'); expect(getByTestId('survey_ecological_season').textContent).toEqual('Season 1'); expect(getAllByTestId('survey_vantage_code').map((item) => item.textContent)).toEqual([ 'Vantage Code 1', From c34bc8a5cfd8335ce1138c6efb00ff319b792f3e Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Mon, 30 Oct 2023 15:04:59 -0700 Subject: [PATCH 09/12] removed field method and added site strategy to project seed --- .../src/seeds/03_basic_project_survey_setup.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/database/src/seeds/03_basic_project_survey_setup.ts b/database/src/seeds/03_basic_project_survey_setup.ts index 54e43a8888..976738b2a1 100644 --- a/database/src/seeds/03_basic_project_survey_setup.ts +++ b/database/src/seeds/03_basic_project_survey_setup.ts @@ -64,6 +64,7 @@ export async function seed(knex: Knex): Promise { ${insertSurveyVantageData(surveyId)} ${insertSurveyParticipationData(surveyId)} ${insertSurveyLocationData(surveyId)} + ${insertSurveySiteStrategy(surveyId)} `); } } @@ -82,6 +83,18 @@ const checkAnyProjectExists = () => ` project; `; +const insertSurveySiteStrategy = (surveyId: number) => ` + INSERT into survey_site_strategy + ( + survey_id, + site_strategy_id + ) + VALUES ( + ${surveyId}, + (select site_strategy_id from site_strategy ss order by random() limit 1) + ); +`; + /** * SQL to insert Project Program data * @@ -303,7 +316,6 @@ const insertSurveyData = (projectId: number) => ` ( project_id, name, - field_method_id, additional_details, start_date, end_date, @@ -315,7 +327,6 @@ const insertSurveyData = (projectId: number) => ` VALUES ( ${projectId}, 'Seed Survey', - (select field_method_id from field_method order by random() limit 1), $$${faker.lorem.sentences(2)}$$, $$${faker.date.between({ from: '2010-01-01T00:00:00-08:00', to: '2015-01-01T00:00:00-08:00' }).toISOString()}$$, $$${faker.date.between({ from: '2020-01-01T00:00:00-08:00', to: '2025-01-01T00:00:00-08:00' }).toISOString()}$$, From d385e923365afdfb424475655b60b4e5b44d2dd7 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Tue, 31 Oct 2023 09:34:08 -0700 Subject: [PATCH 10/12] removed remaining mentions of field method --- api/src/models/survey-create.test.ts | 9 -------- api/src/models/survey-create.ts | 2 -- api/src/models/survey-update.test.ts | 9 -------- api/src/models/survey-update.ts | 2 -- api/src/models/survey-view.test.ts | 9 -------- api/src/models/survey-view.ts | 2 -- api/src/paths/codes.ts | 15 ------------ .../survey/{surveyId}/view.test.ts | 2 -- api/src/repositories/code-repository.ts | 23 ------------------- .../repositories/survey-repository.test.ts | 6 ----- api/src/repositories/survey-repository.ts | 6 ----- api/src/repositories/validation-repository.ts | 7 +----- api/src/services/code-service.test.ts | 1 - api/src/services/code-service.ts | 3 --- api/src/services/eml-service.test.ts | 1 - api/src/services/eml-service.ts | 4 ---- api/src/services/validation-service.ts | 8 +------ .../components/PurposeAndMethodologyForm.tsx | 2 -- .../features/surveys/edit/EditSurveyForm.tsx | 1 - app/src/interfaces/useCodesApi.interface.ts | 1 - app/src/interfaces/useSurveyApi.interface.ts | 2 -- app/src/test-helpers/code-helpers.ts | 4 ---- app/src/test-helpers/survey-helpers.ts | 1 - 23 files changed, 2 insertions(+), 118 deletions(-) diff --git a/api/src/models/survey-create.test.ts b/api/src/models/survey-create.test.ts index 2ccdabedb8..08dbcfaa30 100644 --- a/api/src/models/survey-create.test.ts +++ b/api/src/models/survey-create.test.ts @@ -377,10 +377,6 @@ describe('PostPurposeAndMethodologyData', () => { expect(data.additional_details).to.equal(null); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.equal(null); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.equal(null); }); @@ -400,7 +396,6 @@ describe('PostPurposeAndMethodologyData', () => { const obj = { intended_outcome_id: 1, additional_details: 'additional_detail', - field_method_id: 2, ecological_season_id: 3, vantage_code_ids: [4, 5], surveyed_all_areas: true @@ -418,10 +413,6 @@ describe('PostPurposeAndMethodologyData', () => { expect(data.additional_details).to.eql(obj.additional_details); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.eql(obj.field_method_id); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.eql(obj.ecological_season_id); }); diff --git a/api/src/models/survey-create.ts b/api/src/models/survey-create.ts index 2c479174ce..9b0aab0d2e 100644 --- a/api/src/models/survey-create.ts +++ b/api/src/models/survey-create.ts @@ -123,7 +123,6 @@ export class PostProprietorData { export class PostPurposeAndMethodologyData { intended_outcome_id: number; additional_details: string; - field_method_id: number; ecological_season_id: number; vantage_code_ids: number[]; surveyed_all_areas: boolean; @@ -131,7 +130,6 @@ export class PostPurposeAndMethodologyData { constructor(obj?: any) { this.intended_outcome_id = obj?.intended_outcome_id || null; this.additional_details = obj?.additional_details || null; - this.field_method_id = obj?.field_method_id || null; this.ecological_season_id = obj?.ecological_season_id || null; this.vantage_code_ids = obj?.vantage_code_ids || []; this.surveyed_all_areas = obj?.surveyed_all_areas || null; diff --git a/api/src/models/survey-update.test.ts b/api/src/models/survey-update.test.ts index 7d3a87d5fc..c1458507ff 100644 --- a/api/src/models/survey-update.test.ts +++ b/api/src/models/survey-update.test.ts @@ -340,10 +340,6 @@ describe('PutPurposeAndMethodologyData', () => { expect(data.additional_details).to.equal(null); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.equal(null); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.equal(null); }); @@ -367,7 +363,6 @@ describe('PutPurposeAndMethodologyData', () => { const obj = { intended_outcome_id: 1, additional_details: 'additional_detail', - field_method_id: 2, ecological_season_id: 3, vantage_code_ids: [4, 5], surveyed_all_areas: 'true', @@ -386,10 +381,6 @@ describe('PutPurposeAndMethodologyData', () => { expect(data.additional_details).to.equal(obj.additional_details); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.equal(obj.field_method_id); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.equal(obj.ecological_season_id); }); diff --git a/api/src/models/survey-update.ts b/api/src/models/survey-update.ts index 561efacb8c..5b631c57ba 100644 --- a/api/src/models/survey-update.ts +++ b/api/src/models/survey-update.ts @@ -132,7 +132,6 @@ export class PutSurveyProprietorData { } export class PutSurveyPurposeAndMethodologyData { intended_outcome_id: number; - field_method_id: number; additional_details: string; ecological_season_id: number; vantage_code_ids: number[]; @@ -141,7 +140,6 @@ export class PutSurveyPurposeAndMethodologyData { constructor(obj?: any) { this.intended_outcome_id = obj?.intended_outcome_id || null; - this.field_method_id = obj?.field_method_id || null; this.additional_details = obj?.additional_details || null; this.ecological_season_id = obj?.ecological_season_id || null; this.vantage_code_ids = (obj?.vantage_code_ids?.length && obj.vantage_code_ids) || []; diff --git a/api/src/models/survey-view.test.ts b/api/src/models/survey-view.test.ts index 2c057bd8c7..56fe38b8c8 100644 --- a/api/src/models/survey-view.test.ts +++ b/api/src/models/survey-view.test.ts @@ -344,10 +344,6 @@ describe('GetSurveyPurposeAndMethodologyData', () => { expect(data.additional_details).to.equal(''); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.equal(null); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.equal(null); }); @@ -363,7 +359,6 @@ describe('GetSurveyPurposeAndMethodologyData', () => { const obj = { intended_outcome_id: 1, additional_details: 'additional_detail', - field_method_id: 2, ecological_season_id: 3, vantage_ids: [4, 5], revision_count: 'count' @@ -381,10 +376,6 @@ describe('GetSurveyPurposeAndMethodologyData', () => { expect(data.additional_details).to.eql(obj.additional_details); }); - it('sets field_method_id', () => { - expect(data.field_method_id).to.eql(obj.field_method_id); - }); - it('sets ecological_season_id', () => { expect(data.ecological_season_id).to.eql(obj.ecological_season_id); }); diff --git a/api/src/models/survey-view.ts b/api/src/models/survey-view.ts index ca6285cd67..2863884d74 100644 --- a/api/src/models/survey-view.ts +++ b/api/src/models/survey-view.ts @@ -125,7 +125,6 @@ export class GetPermitData { export class GetSurveyPurposeAndMethodologyData { intended_outcome_id: number; additional_details: string; - field_method_id: number; ecological_season_id: number; revision_count: number; vantage_code_ids: number[]; @@ -133,7 +132,6 @@ export class GetSurveyPurposeAndMethodologyData { constructor(obj?: any) { this.intended_outcome_id = obj?.intended_outcome_id || null; this.additional_details = obj?.additional_details || ''; - this.field_method_id = obj?.field_method_id || null; this.ecological_season_id = obj?.ecological_season_id || null; this.vantage_code_ids = (obj?.vantage_ids?.length && obj.vantage_ids) || []; this.revision_count = obj?.revision_count ?? 0; diff --git a/api/src/paths/codes.ts b/api/src/paths/codes.ts index f9fecdd770..4bec1b5d2a 100644 --- a/api/src/paths/codes.ts +++ b/api/src/paths/codes.ts @@ -33,7 +33,6 @@ GET.apiDoc = { 'system_roles', 'project_roles', 'administrative_activity_status_type', - 'field_methods', 'ecological_seasons', 'intended_outcomes', 'vantage_codes', @@ -263,20 +262,6 @@ GET.apiDoc = { } } }, - field_methods: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'number' - }, - name: { - type: 'string' - } - } - } - }, ecological_seasons: { type: 'array', items: { diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/view.test.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/view.test.ts index 2bb8d6ec27..ec4f49c24b 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/view.test.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/view.test.ts @@ -39,7 +39,6 @@ describe('survey/{surveyId}/view', () => { }, funding_sources: [], purpose_and_methodology: { - field_method_id: 1, additional_details: 'details', intended_outcome_id: 8, ecological_season_id: 1, @@ -118,7 +117,6 @@ describe('survey/{surveyId}/view', () => { }, funding_sources: [], purpose_and_methodology: { - field_method_id: 1, additional_details: null, intended_outcome_id: null, ecological_season_id: null, diff --git a/api/src/repositories/code-repository.ts b/api/src/repositories/code-repository.ts index 8a1e6b4fdc..6497cf58de 100644 --- a/api/src/repositories/code-repository.ts +++ b/api/src/repositories/code-repository.ts @@ -31,7 +31,6 @@ export const IAllCodeSets = z.object({ system_roles: CodeSet(), project_roles: CodeSet(), administrative_activity_status_type: CodeSet(), - field_methods: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape), ecological_seasons: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape), intended_outcomes: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape), vantage_codes: CodeSet(), @@ -161,28 +160,6 @@ export class CodeRepository extends BaseRepository { return response.rows; } - /** - * Fetch field method codes. - * - * @return {*} - * @memberof CodeRepository - */ - async getFieldMethods() { - const sqlStatement = SQL` - SELECT - field_method_id as id, - name, description - FROM - field_method - WHERE - record_end_date is null; - `; - - const response = await this.connection.sql(sqlStatement); - - return response.rows; - } - /** * Fetch ecological season codes. * diff --git a/api/src/repositories/survey-repository.test.ts b/api/src/repositories/survey-repository.test.ts index 842f8c3c80..49f3c029d3 100644 --- a/api/src/repositories/survey-repository.test.ts +++ b/api/src/repositories/survey-repository.test.ts @@ -466,7 +466,6 @@ describe('SurveyRepository', () => { survey_types: [1, 2] }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, @@ -494,7 +493,6 @@ describe('SurveyRepository', () => { survey_types: [1, 2] }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, @@ -522,7 +520,6 @@ describe('SurveyRepository', () => { survey_types: [1, 2] }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, @@ -848,7 +845,6 @@ describe('SurveyRepository', () => { revision_count: 1 }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, @@ -877,7 +873,6 @@ describe('SurveyRepository', () => { revision_count: 1 }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, @@ -906,7 +901,6 @@ describe('SurveyRepository', () => { revision_count: 1 }, purpose_and_methodology: { - field_method_id: 1, additional_details: '', ecological_season_id: 1, intended_outcome_id: 1, diff --git a/api/src/repositories/survey-repository.ts b/api/src/repositories/survey-repository.ts index ece23b87eb..12ba5dd655 100644 --- a/api/src/repositories/survey-repository.ts +++ b/api/src/repositories/survey-repository.ts @@ -79,7 +79,6 @@ const SurveyRecord = z.object({ uuid: z.string().nullable(), start_date: z.string(), end_date: z.string().nullable(), - field_method_id: z.number().nullable(), additional_details: z.string().nullable(), ecological_season_id: z.number().nullable(), intended_outcome_id: z.number().nullable(), @@ -242,7 +241,6 @@ export class SurveyRepository extends BaseRepository { async getSurveyPurposeAndMethodology(surveyId: number): Promise { const sqlStatement = SQL` SELECT - s.field_method_id, s.additional_details, s.ecological_season_id, s.intended_outcome_id, @@ -256,7 +254,6 @@ export class SurveyRepository extends BaseRepository { WHERE s.survey_id = ${surveyId} GROUP BY - s.field_method_id, s.additional_details, s.ecological_season_id, s.intended_outcome_id; @@ -581,7 +578,6 @@ export class SurveyRepository extends BaseRepository { name, start_date, end_date, - field_method_id, additional_details, ecological_season_id, intended_outcome_id @@ -590,7 +586,6 @@ export class SurveyRepository extends BaseRepository { ${surveyData.survey_details.survey_name}, ${surveyData.survey_details.start_date}, ${surveyData.survey_details.end_date}, - ${surveyData.purpose_and_methodology.field_method_id}, ${surveyData.purpose_and_methodology.additional_details}, ${surveyData.purpose_and_methodology.ecological_season_id}, ${surveyData.purpose_and_methodology.intended_outcome_id} @@ -892,7 +887,6 @@ export class SurveyRepository extends BaseRepository { if (surveyData.purpose_and_methodology) { fieldsToUpdate = { ...fieldsToUpdate, - field_method_id: surveyData.purpose_and_methodology.field_method_id, additional_details: surveyData.purpose_and_methodology.additional_details, ecological_season_id: surveyData.purpose_and_methodology.ecological_season_id, intended_outcome_id: surveyData.purpose_and_methodology.intended_outcome_id diff --git a/api/src/repositories/validation-repository.ts b/api/src/repositories/validation-repository.ts index 6fe4c4b21d..c04bc77f28 100644 --- a/api/src/repositories/validation-repository.ts +++ b/api/src/repositories/validation-repository.ts @@ -27,7 +27,6 @@ export class ValidationRepository extends BaseRepository { async getTemplateMethodologySpeciesRecord( templateName: string, templateVersion: string, - surveyFieldMethodId: number, surveySpecies: number[] ): Promise { const templateRow = await this.getTemplateNameVersionId(templateName, templateVersion); @@ -50,11 +49,7 @@ export class ValidationRepository extends BaseRepository { const queryBuilder = getKnex() .select('template_methodology_species_id', 'wldtaxonomic_units_id', 'validation', 'transform') .from('template_methodology_species') - .where('template_id', templateRow.template_id) - .and.where(function (qb) { - qb.or.where('field_method_id', surveyFieldMethodId); - qb.or.where('field_method_id', null); - }); + .where('template_id', templateRow.template_id); const response = await this.connection.knex(queryBuilder); diff --git a/api/src/services/code-service.test.ts b/api/src/services/code-service.test.ts index c7d6f47cb5..e857e1f9f9 100644 --- a/api/src/services/code-service.test.ts +++ b/api/src/services/code-service.test.ts @@ -40,7 +40,6 @@ describe('CodeService', () => { 'project_roles', 'administrative_activity_status_type', 'ecological_seasons', - 'field_methods', 'intended_outcomes', 'vantage_codes', 'site_selection_strategies', diff --git a/api/src/services/code-service.ts b/api/src/services/code-service.ts index 1ce27d4a7a..f73dd1d815 100644 --- a/api/src/services/code-service.ts +++ b/api/src/services/code-service.ts @@ -36,7 +36,6 @@ export class CodeService extends DBService { system_roles, project_roles, administrative_activity_status_type, - field_methods, ecological_seasons, intended_outcomes, vantage_codes, @@ -57,7 +56,6 @@ export class CodeService extends DBService { await this.codeRepository.getSystemRoles(), await this.codeRepository.getProjectRoles(), await this.codeRepository.getAdministrativeActivityStatusType(), - await this.codeRepository.getFieldMethods(), await this.codeRepository.getEcologicalSeasons(), await this.codeRepository.getIntendedOutcomes(), await this.codeRepository.getVantageCodes(), @@ -80,7 +78,6 @@ export class CodeService extends DBService { system_roles, project_roles, administrative_activity_status_type, - field_methods, ecological_seasons, intended_outcomes, vantage_codes, diff --git a/api/src/services/eml-service.test.ts b/api/src/services/eml-service.test.ts index a35bc095b7..a99cb24bdd 100644 --- a/api/src/services/eml-service.test.ts +++ b/api/src/services/eml-service.test.ts @@ -987,7 +987,6 @@ describe.skip('EmlService', () => { project_roles: [], administrative_activity_status_type: [], ecological_seasons: [], - field_methods: [], intended_outcomes: [], vantage_codes: [], site_selection_strategies: [], diff --git a/api/src/services/eml-service.ts b/api/src/services/eml-service.ts index 1ab6441a1a..500875f4d6 100644 --- a/api/src/services/eml-service.ts +++ b/api/src/services/eml-service.ts @@ -981,10 +981,6 @@ export class EmlService extends DBService { return { description: { section: [ - { - title: 'Field Method', - para: codes.field_methods.find((code) => code.id === survey.purpose_and_methodology.field_method_id)?.name - }, { title: 'Ecological Season', para: codes.ecological_seasons.find( diff --git a/api/src/services/validation-service.ts b/api/src/services/validation-service.ts index d4032e48a1..6d82356579 100644 --- a/api/src/services/validation-service.ts +++ b/api/src/services/validation-service.ts @@ -332,15 +332,9 @@ export class ValidationService extends DBService { const surveyData = await this.surveyService.getSurveyById(surveyId); - const surveyFieldMethodId = surveyData.purpose_and_methodology.field_method_id; const surveySpecies = surveyData.species.focal_species; - return this.validationRepository.getTemplateMethodologySpeciesRecord( - templateName, - templateVersion, - surveyFieldMethodId, - surveySpecies - ); + return this.validationRepository.getTemplateMethodologySpeciesRecord(templateName, templateVersion, surveySpecies); } async getValidationSchema(file: XLSXCSV, surveyId: number): Promise { diff --git a/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx b/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx index 6626e9ec63..7caf0fe84b 100644 --- a/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx +++ b/app/src/features/surveys/components/PurposeAndMethodologyForm.tsx @@ -13,7 +13,6 @@ export interface IPurposeAndMethodologyForm { purpose_and_methodology: { intended_outcome_id: number; additional_details: string; - field_method_id: number | null; ecological_season_id: number; vantage_code_ids: number[]; }; @@ -23,7 +22,6 @@ export const PurposeAndMethodologyInitialValues: IPurposeAndMethodologyForm = { purpose_and_methodology: { intended_outcome_id: '' as unknown as number, additional_details: '', - field_method_id: null, ecological_season_id: '' as unknown as number, vantage_code_ids: [] } diff --git a/app/src/features/surveys/edit/EditSurveyForm.tsx b/app/src/features/surveys/edit/EditSurveyForm.tsx index 5c92979904..e1103f809b 100644 --- a/app/src/features/surveys/edit/EditSurveyForm.tsx +++ b/app/src/features/surveys/edit/EditSurveyForm.tsx @@ -75,7 +75,6 @@ const EditSurveyForm: React.FC = (props) => { purpose_and_methodology: { intended_outcome_id: '' as unknown as number, additional_details: '', - field_method_id: '' as unknown as number, ecological_season_id: '' as unknown as number, vantage_code_ids: [] } diff --git a/app/src/interfaces/useCodesApi.interface.ts b/app/src/interfaces/useCodesApi.interface.ts index a7bfa3edc4..056c70f3ee 100644 --- a/app/src/interfaces/useCodesApi.interface.ts +++ b/app/src/interfaces/useCodesApi.interface.ts @@ -34,7 +34,6 @@ export interface IGetAllCodeSetsResponse { system_roles: CodeSet; project_roles: CodeSet; administrative_activity_status_type: CodeSet; - field_methods: CodeSet<{ id: number; name: string; description: string }>; intended_outcomes: CodeSet<{ id: number; name: string; description: string }>; ecological_seasons: CodeSet<{ id: number; name: string; description: string }>; vantage_codes: CodeSet; diff --git a/app/src/interfaces/useSurveyApi.interface.ts b/app/src/interfaces/useSurveyApi.interface.ts index 4996d4099d..e5a2d0f3c3 100644 --- a/app/src/interfaces/useSurveyApi.interface.ts +++ b/app/src/interfaces/useSurveyApi.interface.ts @@ -63,7 +63,6 @@ export interface IGetSurveyForViewResponseDetails { export interface IGetSurveyForViewResponsePurposeAndMethodology { intended_outcome_id: number; additional_details: string; - field_method_id: number; ecological_season_id: number; vantage_code_ids: number[]; surveyed_all_areas: StringBoolean; @@ -164,7 +163,6 @@ export interface SurveyUpdateObject extends ISurveyLocationForm { purpose_and_methodology?: { intended_outcome_id: number; additional_details: string; - field_method_id: number; ecological_season_id: number; vantage_code_ids: number[]; surveyed_all_areas: StringBoolean; diff --git a/app/src/test-helpers/code-helpers.ts b/app/src/test-helpers/code-helpers.ts index 948663567e..565e7b01f9 100644 --- a/app/src/test-helpers/code-helpers.ts +++ b/app/src/test-helpers/code-helpers.ts @@ -36,10 +36,6 @@ export const codes: IGetAllCodeSetsResponse = { { id: 2, name: 'Actioned' }, { id: 3, name: 'Rejected' } ], - field_methods: [ - { id: 1, name: 'Recruitment', description: 'Description' }, - { id: 2, name: 'SRB', description: 'Description' } - ], ecological_seasons: [ { id: 1, name: 'Season 1', description: 'Description' }, { id: 2, name: 'Season 2', description: 'Description' } diff --git a/app/src/test-helpers/survey-helpers.ts b/app/src/test-helpers/survey-helpers.ts index dab505ab5e..3166ce673c 100644 --- a/app/src/test-helpers/survey-helpers.ts +++ b/app/src/test-helpers/survey-helpers.ts @@ -22,7 +22,6 @@ export const surveyObject: SurveyViewObject = { purpose_and_methodology: { intended_outcome_id: 1, additional_details: 'details', - field_method_id: 1, ecological_season_id: 1, vantage_code_ids: [1, 2], surveyed_all_areas: 'true' From 300787bbaa840e85da54451646bf76db4ad70f8a Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Tue, 31 Oct 2023 10:08:48 -0700 Subject: [PATCH 11/12] fixed more tests --- api/src/repositories/validation-repository.test.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/api/src/repositories/validation-repository.test.ts b/api/src/repositories/validation-repository.test.ts index 78d7a2057c..7f6bf8e326 100644 --- a/api/src/repositories/validation-repository.test.ts +++ b/api/src/repositories/validation-repository.test.ts @@ -24,7 +24,6 @@ describe('ValidationRepository', () => { const templateName = 'template Name'; const templateVersion = '1'; - const fieldMethodId = 10; const surveySpecies = [10]; const mockResponse = ({ @@ -43,12 +42,7 @@ describe('ValidationRepository', () => { }); const repo = new ValidationRepository(dbConnection); - const response = await repo.getTemplateMethodologySpeciesRecord( - templateName, - templateVersion, - fieldMethodId, - surveySpecies - ); + const response = await repo.getTemplateMethodologySpeciesRecord(templateName, templateVersion, surveySpecies); expect(response.template_methodology_species_id).to.be.eql(1); expect(response.validation).to.be.eql('{}'); expect(response.transform).to.be.eql('{}'); @@ -65,7 +59,7 @@ describe('ValidationRepository', () => { const repo = new ValidationRepository(dbConnection); try { - await repo.getTemplateMethodologySpeciesRecord('name', 'version', 1, [1]); + await repo.getTemplateMethodologySpeciesRecord('name', 'version', [1]); expect.fail(); } catch (error) { expect((error as HTTP400).message).to.be.eql('Failed to query template methodology species table'); From 821e9486b97175ef1e302239aeee9dc8767aaa26 Mon Sep 17 00:00:00 2001 From: Alfred Rosenthal Date: Tue, 31 Oct 2023 12:39:11 -0700 Subject: [PATCH 12/12] ran fix --- api/src/paths/project/{projectId}/survey/list.ts | 7 +------ .../paths/project/{projectId}/survey/{surveyId}/update.ts | 7 +------ .../project/{projectId}/survey/{surveyId}/update/get.ts | 7 +------ .../paths/project/{projectId}/survey/{surveyId}/view.ts | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/api/src/paths/project/{projectId}/survey/list.ts b/api/src/paths/project/{projectId}/survey/list.ts index 4a8e62515d..b8d2e39e71 100644 --- a/api/src/paths/project/{projectId}/survey/list.ts +++ b/api/src/paths/project/{projectId}/survey/list.ts @@ -170,12 +170,7 @@ GET.apiDoc = { purpose_and_methodology: { description: 'Survey Details', type: 'object', - required: [ - 'additional_details', - 'intended_outcome_id', - 'vantage_code_ids', - 'revision_count' - ], + required: ['additional_details', 'intended_outcome_id', 'vantage_code_ids', 'revision_count'], properties: { additional_details: { type: 'string', diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts index ac22631581..4ac29a92bf 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update.ts @@ -210,12 +210,7 @@ PUT.apiDoc = { }, purpose_and_methodology: { type: 'object', - required: [ - 'intended_outcome_id', - 'additional_details', - 'vantage_code_ids', - 'revision_count' - ], + required: ['intended_outcome_id', 'additional_details', 'vantage_code_ids', 'revision_count'], properties: { intended_outcome_id: { type: 'number' diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts index 590c3a9dc2..fa5e59b31b 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/update/get.ts @@ -209,12 +209,7 @@ GET.apiDoc = { purpose_and_methodology: { description: 'Survey Details', type: 'object', - required: [ - 'additional_details', - 'intended_outcome_id', - 'vantage_code_ids', - 'revision_count' - ], + required: ['additional_details', 'intended_outcome_id', 'vantage_code_ids', 'revision_count'], properties: { additional_details: { type: 'string', diff --git a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts index c16e0c0eb8..4313fa9a35 100644 --- a/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts +++ b/api/src/paths/project/{projectId}/survey/{surveyId}/view.ts @@ -230,12 +230,7 @@ GET.apiDoc = { purpose_and_methodology: { description: 'Survey Details', type: 'object', - required: [ - 'additional_details', - 'intended_outcome_id', - 'vantage_code_ids', - 'revision_count' - ], + required: ['additional_details', 'intended_outcome_id', 'vantage_code_ids', 'revision_count'], properties: { additional_details: { type: 'string',