From 9433a3e6c60f3543038483978484ef7bb36ceb6a Mon Sep 17 00:00:00 2001 From: Grace Pigeau <122994497+grapigeau@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:49:16 -0500 Subject: [PATCH] Glt 4288.release status signoffs (#164) * add a boolean release field to the signoff table --- CHANGELOG.md | 4 ++++ components/signoffs/signoffController.js | 1 + components/signoffs/signoffDao.js | 3 +++ sql/V013__add_release_to_signoff.sql | 1 + swagger.json | 12 ++++++++++++ test/migrations/V9000__test_data.sql | 12 ++++++------ test/signoffTest.js | 1 + 7 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 sql/V013__add_release_to_signoff.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e43ed..184f812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project attempts to adhere to Semantic Versioning. ## UNRELEASED +### Changed + +* Add optional release status (boolean) to sign-off records + ## 3.9.0: [2024-09-16] ### Changed diff --git a/components/signoffs/signoffController.js b/components/signoffs/signoffController.js index 4513f39..6f67741 100644 --- a/components/signoffs/signoffController.js +++ b/components/signoffs/signoffController.js @@ -204,6 +204,7 @@ function validateObjectsFromUser (unvalidated) { signoffStepName: stepname, deliverable: validateDeliverable(unvalidated.deliverable, stepname), comment: validateComment(unvalidated.comment), + release: nullifyIfBlank(unvalidated.release), }; for (const [, value] of Object.entries(fromUser)) { if (value instanceof ValidationError) { diff --git a/components/signoffs/signoffDao.js b/components/signoffs/signoffDao.js index 67e05d3..4d4b389 100644 --- a/components/signoffs/signoffDao.js +++ b/components/signoffs/signoffDao.js @@ -12,6 +12,7 @@ const signoffStepName = 'signoff_step_name'; const deliverableType = 'deliverable_type'; const deliverable = 'deliverable'; const comment = 'comment'; +const release = 'release'; const signoffColsCreate = new pgp.helpers.ColumnSet( [ @@ -22,6 +23,7 @@ const signoffColsCreate = new pgp.helpers.ColumnSet( deliverableType, deliverable, comment, + release, ], { table: 'signoff' } ); @@ -36,6 +38,7 @@ const addSignoff = (caseId, signed, oldSignoffId = null) => { deliverable_type: signed.deliverableType, deliverable: signed.deliverable, comment: signed.comment, + release: signed.release, }; const signoffInsert = pgp.helpers.insert( diff --git a/sql/V013__add_release_to_signoff.sql b/sql/V013__add_release_to_signoff.sql new file mode 100644 index 0000000..66b25e9 --- /dev/null +++ b/sql/V013__add_release_to_signoff.sql @@ -0,0 +1 @@ +ALTER TABLE signoff ADD COLUMN release boolean NULL; \ No newline at end of file diff --git a/swagger.json b/swagger.json index e71bd35..fd024f4 100644 --- a/swagger.json +++ b/swagger.json @@ -1170,6 +1170,10 @@ "comment": { "description": "Optional URL-escaped reason why sign-off is PASS or FAIL", "type": "string" + }, + "release": { + "description": "Optional boolean for release status", + "type": "boolean" } } }, @@ -1206,6 +1210,10 @@ "comment": { "description": "Optional URL-escaped reason why sign-off is PASS or FAIL", "type": "string" + }, + "release": { + "description": "Optional boolean for release status", + "type": "boolean" } } }, @@ -1248,6 +1256,10 @@ "comment": { "description": "URL-escaped reason why sign-off is PASS or FAIL (only returned if a sign-off record is found and a comment was provided)", "type": "string" + }, + "release": { + "description": "Optional boolean for release status", + "type": "boolean" } }, "required": [ diff --git a/test/migrations/V9000__test_data.sql b/test/migrations/V9000__test_data.sql index 87e2278..8da50c7 100644 --- a/test/migrations/V9000__test_data.sql +++ b/test/migrations/V9000__test_data.sql @@ -17,11 +17,11 @@ INSERT INTO archive (case_id, workflow_run_ids_for_offsite_archive, unload_file_ ((SELECT id FROM cardea_case WHERE case_identifier = 'R12_TEST_1212_Ab_C'), '{"vidarr:research/run/ac7fa728822f4b801f17cb6aa5d597e32642e6e36a2089fb3c947e4d7d679203", "vidarr:research/run/93d25e166f7ea82c6eb17e48e62e4134939fcaf75c9b9f953819797f4878d961", "vidarr:research/run/8b7fb588926f5efcdfe9824e867b91c93829c383f4177f87b92288b2f2554f8f", "vidarr:research/run/88065a62eeb0ad351f48ff9a3a32cdbdbe4bedf1e386603c1d4d8cfd46d5acd0", "vidarr:research/run/86b9da7b2b84174daef0f29beecf84453d8f987c46805121bf3109e0de48dc14"}', NULL, NULL, NULL, '{"vidarr:research/run/d8cc36839b0dd246af6940f175f089bf2007f5dcb01a00bc53a55526060250f9"}', NULL, NULL, NULL); DELETE FROM signoff; -INSERT INTO signoff (case_identifier, qc_passed, username, signoff_step_name, deliverable_type, deliverable, comment) VALUES -('R11_TEST_1000_Xy_Z', TRUE, 'me', 'RELEASE', 'CLINICAL_REPORT', 'X', ''), -('R12_TEST_1212_Ab_C', FALSE, 'me', 'ANALYSIS_REVIEW', 'DATA_RELEASE', '', ''), -('R12_TEST_9999_De_F', null, 'me', 'RELEASE', 'DATA_RELEASE', 'X', ''), -('R12_TEST_9999_De_F', TRUE, 'me', 'ANALYSIS_REVIEW', 'DATA_RELEASE', '', ''), -('R12_TEST_9999_De_F', FALSE, 'me', 'RELEASE_APPROVAL', 'DATA_RELEASE', '', ''); +INSERT INTO signoff (case_identifier, qc_passed, username, signoff_step_name, deliverable_type, deliverable, comment, release) VALUES +('R11_TEST_1000_Xy_Z', TRUE, 'me', 'RELEASE', 'CLINICAL_REPORT', 'X', '', NULL), +('R12_TEST_1212_Ab_C', FALSE, 'me', 'ANALYSIS_REVIEW', 'DATA_RELEASE', '', '', NULL), +('R12_TEST_9999_De_F', null, 'me', 'RELEASE', 'DATA_RELEASE', 'X', '', NULL), +('R12_TEST_9999_De_F', TRUE, 'me', 'ANALYSIS_REVIEW', 'DATA_RELEASE', '', '', NULL), +('R12_TEST_9999_De_F', FALSE, 'me', 'RELEASE_APPROVAL', 'DATA_RELEASE', '', '', NULL); INSERT INTO token (auth_token, auth_id, username) VALUES ('7e9668724e31742d:164f53c7057e2667de55ae8ad9c1df7fbf85f261f4d89e8f696a81b1ed9972652ed33269eaaa61f738f04cfb8310372e99faad26b1dee5dd1488d3d2dcfcf835', 'wdew0h5hoxvraj1xhrzix4j6nbswhh','inital'); \ No newline at end of file diff --git a/test/signoffTest.js b/test/signoffTest.js index 923b029..ebdf132 100644 --- a/test/signoffTest.js +++ b/test/signoffTest.js @@ -21,6 +21,7 @@ const signoffProperties = [ 'deliverableType', 'deliverable', 'comment', + 'release', ]; const testingToken =