From 9b0f1c979b6ceefa6f049c2758ef245ca07b7290 Mon Sep 17 00:00:00 2001 From: Jareth Whitney Date: Fri, 22 Nov 2024 15:41:44 -0800 Subject: [PATCH 1/5] feature/deseng745: Updated project definition to add project type multiselect values. --- CHANGELOG.md | 3 ++- api/controllers/project.js | 2 ++ api/helpers/models/project.js | 1 + api/swagger/swagger.yaml | 22 ++++++++++++++++++++++ seed/jsongenerator/projectschema | 3 ++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42968da..1ac6fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -### 1.10.0 Nov 15, 2024 +### 1.10.0 Nov 22, 2024 * Modified project definition to accomodate shape file colours. [DESENG-743](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-743) +* Modified project definition to accomodate project type multiselect. [DESENG-745](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-745) ### 1.9.0 Mar 11, 2024 * Add option for contact form on projects [DESENG-373](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-373) diff --git a/api/controllers/project.js b/api/controllers/project.js index b15bf20..5afc3ec 100644 --- a/api/controllers/project.js +++ b/api/controllers/project.js @@ -45,6 +45,7 @@ const tagList = [ 'provElecDist', 'shortName', 'projectPhase', + 'projectTypes', 'substitution', 'updatedBy', 'projectLead', @@ -848,6 +849,7 @@ exports.protectedPut = async (args, res) => { obj.region = projectObj.region; obj.shapeFileColour = projectObj.shapeFileColour; obj.projectPhase = projectObj.projectPhase; + obj.projectTypes = projectObj.projectTypes; obj.name = projectObj.name; obj.centroid = projectObj.centroid; obj.projectLead = projectObj.projectLead; diff --git a/api/helpers/models/project.js b/api/helpers/models/project.js index ff3036e..aba4a81 100644 --- a/api/helpers/models/project.js +++ b/api/helpers/models/project.js @@ -37,6 +37,7 @@ const definition = { provElecDist: { type: String, default: '' }, shortName: { type: String, default: '', index: true }, projectPhase: { type: String, default: '' }, + projectTypes: { type: Array, default: [] }, substitution: { type: Boolean, default: false }, projectLead: { type: 'ObjectId', ref: 'User', default: null, index: true }, projectDirector: { type: 'ObjectId', ref: 'User', default: null, index: true }, diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 3b583eb..fb847a6 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -900,6 +900,12 @@ paths: type: string required: false description: "Get a Project that relates to this Project Phase." + - in: query + collectionFormat: multi + name: projectTypes + type: array + required: false + description: "Get a Project that relates to these project types." - in: query name: agreements type: string @@ -1016,6 +1022,12 @@ paths: type: string required: false description: "Get a Project that relates to this Project Phase." + - in: query + collectionFormat: multi + name: projectTypes + type: array + required: false + description: "Get a Project that relates to these project types." - in: query name: agreements type: string @@ -2629,6 +2641,11 @@ paths: description: "The project phase of the file." required: false type: string + - name: projectTypes + in: formData + description: "The project types of the file." + required: false + type: array - name: datePosted in: formData description: "The datePosted of the file." @@ -2863,6 +2880,11 @@ paths: description: "The project phase of the file." required: false type: string + - name: projectTypes + in: formData + description: "The project types of the file." + required: false + type: array - name: datePosted in: formData description: "The datePosted of the file." diff --git a/seed/jsongenerator/projectschema b/seed/jsongenerator/projectschema index 8a91e0c..55bad96 100644 --- a/seed/jsongenerator/projectschema +++ b/seed/jsongenerator/projectschema @@ -32,7 +32,8 @@ proMember : '{{lorem(1, "words")}}', provElecDist : '{{lorem(1, "words")}}', shortName : '{{lorem(1, "words")}}', - projectPhase : '{{lorem(1, "words")}}', + projectPhase : '{{lorem(1, "words")}}', + projectTypes : '{{lorem(2, "words")}}', substitution : 'false', } } From 9c73677d2f1061a221871e793d9d9f8cb55ea5cb Mon Sep 17 00:00:00 2001 From: Jareth Whitney Date: Fri, 22 Nov 2024 16:02:46 -0800 Subject: [PATCH 2/5] feature/deseng745: Fixed indents that were wonky in new code. --- api/controllers/project.js | 2 +- api/helpers/models/project.js | 2 +- seed/jsongenerator/projectschema | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/controllers/project.js b/api/controllers/project.js index 5afc3ec..8f393ac 100644 --- a/api/controllers/project.js +++ b/api/controllers/project.js @@ -45,7 +45,7 @@ const tagList = [ 'provElecDist', 'shortName', 'projectPhase', - 'projectTypes', + 'projectTypes', 'substitution', 'updatedBy', 'projectLead', diff --git a/api/helpers/models/project.js b/api/helpers/models/project.js index aba4a81..10585b8 100644 --- a/api/helpers/models/project.js +++ b/api/helpers/models/project.js @@ -37,7 +37,7 @@ const definition = { provElecDist: { type: String, default: '' }, shortName: { type: String, default: '', index: true }, projectPhase: { type: String, default: '' }, - projectTypes: { type: Array, default: [] }, + projectTypes: { type: Array, default: [] }, substitution: { type: Boolean, default: false }, projectLead: { type: 'ObjectId', ref: 'User', default: null, index: true }, projectDirector: { type: 'ObjectId', ref: 'User', default: null, index: true }, diff --git a/seed/jsongenerator/projectschema b/seed/jsongenerator/projectschema index 55bad96..7847aaf 100644 --- a/seed/jsongenerator/projectschema +++ b/seed/jsongenerator/projectschema @@ -33,7 +33,7 @@ provElecDist : '{{lorem(1, "words")}}', shortName : '{{lorem(1, "words")}}', projectPhase : '{{lorem(1, "words")}}', - projectTypes : '{{lorem(2, "words")}}', + projectTypes : '{{lorem(2, "words")}}', substitution : 'false', } } From 0980d0342a8bdd6209a756e6948dee6f664a890a Mon Sep 17 00:00:00 2001 From: Jareth Whitney Date: Fri, 22 Nov 2024 18:27:41 -0800 Subject: [PATCH 3/5] feature/deseng745: Updated swagger file with missing enums. --- api/swagger/swagger.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index fb847a6..7edf057 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -115,6 +115,7 @@ definitions: - currentPhase - currentPhaseCode - currentPhaseName + - projectTypes - description - details - engagementStatus @@ -137,6 +138,9 @@ definitions: - activitiesAndUpdatesEnabled - contactFormEnabled - contactFormEmails + enum: &projectTypes + - name + - checked TopicSortByFields: type: string description: "Optional fields to sort by (prefixed with + or - for order)" @@ -906,6 +910,9 @@ paths: type: array required: false description: "Get a Project that relates to these project types." + items: + type: string + enum: *projectTypes - in: query name: agreements type: string @@ -1028,6 +1035,9 @@ paths: type: array required: false description: "Get a Project that relates to these project types." + items: + type: string + enum: *projectTypes - in: query name: agreements type: string @@ -2646,6 +2656,9 @@ paths: description: "The project types of the file." required: false type: array + items: + type: string + enum: *projectTypes - name: datePosted in: formData description: "The datePosted of the file." @@ -2885,6 +2898,9 @@ paths: description: "The project types of the file." required: false type: array + items: + type: string + enum: *projectTypes - name: datePosted in: formData description: "The datePosted of the file." From d6767bf1a42dbc4b775d127b541414230480d819 Mon Sep 17 00:00:00 2001 From: Jareth Whitney Date: Mon, 25 Nov 2024 10:55:04 -0800 Subject: [PATCH 4/5] feature/deseng745: Removed misplaced entry in swagger file. --- api/swagger/swagger.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 7edf057..c6cc92f 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -2651,14 +2651,6 @@ paths: description: "The project phase of the file." required: false type: string - - name: projectTypes - in: formData - description: "The project types of the file." - required: false - type: array - items: - type: string - enum: *projectTypes - name: datePosted in: formData description: "The datePosted of the file." From 9f150bcd9730e6c0d09299bbf0a49a7f260e10da Mon Sep 17 00:00:00 2001 From: Jareth Whitney Date: Mon, 25 Nov 2024 11:15:49 -0800 Subject: [PATCH 5/5] feature/deseng745: Removed one more item from swagger file. --- api/swagger/swagger.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index c6cc92f..1b518a3 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -2885,14 +2885,6 @@ paths: description: "The project phase of the file." required: false type: string - - name: projectTypes - in: formData - description: "The project types of the file." - required: false - type: array - items: - type: string - enum: *projectTypes - name: datePosted in: formData description: "The datePosted of the file."