-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
300 changed files
with
17,032 additions
and
8,173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,19 @@ jobs: | |
if: steps.cached-node-modules-backend.outputs.cache-hit != 'true' | ||
run: npm run install:backend | ||
|
||
- name: Cache UOWS | ||
id: cached-UOWS | ||
uses: actions/cache@v4 | ||
with: | ||
path: apps/backend/generated | ||
key: uows-client-${{ hashFiles('apps/backend/openapi.yaml') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Generate backend UOWS | ||
if: steps.cached-UOWS.outputs.cache-hit != 'true' | ||
run: | | ||
cd apps/backend | ||
npm run generate:uows | ||
- name: Cache frontend node_modules | ||
id: cached-node-modules-frontend | ||
uses: actions/cache@v4 | ||
|
@@ -159,6 +172,13 @@ jobs: | |
path: apps/backend/node_modules | ||
key: node-modules-backend-${{ hashFiles('apps/backend/package-lock.json') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Restore backend UOWS | ||
id: cached-UOWS | ||
uses: actions/cache@v4 | ||
with: | ||
path: apps/backend/generated | ||
key: uows-client-${{ hashFiles('apps/backend/openapi.yaml') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Restore frontend node_modules | ||
id: cached-node-modules-frontend | ||
uses: actions/cache@v4 | ||
|
@@ -177,7 +197,7 @@ jobs: | |
sdk-frontend- | ||
- run: npm ci | ||
|
||
- run: npm run build | ||
env: | ||
NODE_ENV: development | ||
|
@@ -203,6 +223,13 @@ jobs: | |
with: | ||
path: apps/backend/node_modules | ||
key: node-modules-backend-${{ hashFiles('apps/backend/package-lock.json') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Restore backend UOWS | ||
id: cached-UOWS | ||
uses: actions/cache@v4 | ||
with: | ||
path: apps/backend/generated | ||
key: uows-client-${{ hashFiles('apps/backend/openapi.yaml') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Run backend unit tests | ||
env: | ||
|
@@ -241,7 +268,9 @@ jobs: | |
- id: rs | ||
files: cypress/e2e/[r-s]*.ts | ||
- id: t | ||
files: cypress/e2e/t*.ts | ||
files: cypress/e2e/t!(emplateDeleteAndArchive).ts | ||
- id: templateDelete | ||
files: cypress/e2e/templateDeleteAndArchive*.ts | ||
- id: uz | ||
files: cypress/e2e/[u-z]*.ts | ||
- id: AZ | ||
|
@@ -268,6 +297,13 @@ jobs: | |
with: | ||
path: apps/backend/node_modules | ||
key: node-modules-backend-${{ hashFiles('apps/backend/package-lock.json') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Restore backend UOWS | ||
id: cached-UOWS | ||
uses: actions/cache@v4 | ||
with: | ||
path: apps/backend/generated | ||
key: uows-client-${{ hashFiles('apps/backend/openapi.yaml') }}-${{ env.NODE_VERSION }} | ||
|
||
- name: Restore frontend node_modules | ||
id: cached-node-modules-frontend | ||
|
@@ -343,7 +379,7 @@ jobs: | |
EMAIL_FOOTER_IMAGE_PATH: /config/logos/STFC-Logo-small.png | ||
EXTERNAL_AUTH_LOGIN_URL: http://localhost:9003/auth/Login.aspx | ||
EXTERNAL_AUTH_LOGOUT_URL: http://localhost:9003/auth/Login.aspx | ||
EXTERNAL_AUTH_SERVICE_URL: http://localhost:1080/ws/UserOfficeWebService?wsdl | ||
EXTERNAL_UOWS_API_URL: http://localhost:1080/users-service | ||
ANTIVIRUS_HOST: clam-antivirus | ||
ANTIVIRUS_PORT: 3310 | ||
ISIS_UO_EMAIL: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
!db_patches | ||
!package* | ||
!tsconfig.json | ||
!index.ts | ||
!index.ts | ||
!openapi.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ coverage | |
.DS_Store | ||
downloads | ||
uploads | ||
generated | ||
|
||
.idea | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
apps/backend/db_patches/0165_AddTechnicalReviewTemplate.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
DO | ||
$$ | ||
DECLARE | ||
technical_review_template_id_var int; | ||
technical_review_topic_id_var int; | ||
technical_review_loop_var int; | ||
BEGIN | ||
IF register_patch('0165_AddTechnicalReviewTemplate.sql', 'Gergely Nyiri', 'Add Technical review template', '2024-10-15') THEN | ||
|
||
INSERT INTO template_categories(template_category_id, name) VALUES(11, 'Technical Review'); | ||
|
||
INSERT INTO template_groups (template_group_id, category_id) VALUES('TECHNICAL_REVIEW_TEMPLATE', 11); | ||
|
||
INSERT INTO question_datatypes(question_datatype_id) VALUES('TECHNICAL_REVIEW_BASIS'); | ||
|
||
INSERT INTO questions( | ||
question_id, | ||
data_type, | ||
question, | ||
default_config, | ||
natural_key, | ||
category_id | ||
) | ||
VALUES( | ||
'technical_review_basis' | ||
, 'TECHNICAL_REVIEW_BASIS' | ||
, 'Technical review basic information' | ||
, '{"required":false,"small_label":"","tooltip":""}' | ||
, 'technical_review_basis' | ||
, 11 | ||
); | ||
|
||
ALTER TABLE technical_review ADD COLUMN questionary_id INTEGER REFERENCES questionaries (questionary_id); | ||
|
||
ALTER TABLE call ADD COLUMN technical_review_template_id INTEGER REFERENCES templates(template_id); | ||
|
||
INSERT INTO templates(name, description, is_archived, group_id) VALUES | ||
('default technical review template', 'default technical review template', false, 'TECHNICAL_REVIEW_TEMPLATE'); | ||
|
||
SELECT templates.template_id | ||
INTO technical_review_template_id_var | ||
FROM templates | ||
WHERE name='default technical review template'; | ||
|
||
INSERT INTO topics(topic_title, is_enabled, sort_order, template_id) VALUES('New technical review', TRUE, 0, technical_review_template_id_var); | ||
|
||
SELECT topics.topic_id | ||
INTO technical_review_topic_id_var | ||
FROM topics | ||
WHERE topic_title='New technical review'; | ||
|
||
INSERT INTO templates_has_questions (question_id, template_id, topic_id, sort_order, config) VALUES('technical_review_basis', technical_review_template_id_var, technical_review_topic_id_var, 0, '{"required":false,"small_label":"","tooltip":""}'); | ||
|
||
UPDATE call set technical_review_template_id = technical_review_template_id_var; | ||
|
||
CREATE OR REPLACE FUNCTION CreateTechnicalReviewQuestionary(p_template_id int) | ||
RETURNS integer AS $func$ | ||
DECLARE | ||
q_id integer; | ||
BEGIN | ||
INSERT INTO questionaries(template_id) VALUES(p_template_id) RETURNING questionary_id INTO q_id; | ||
RETURN q_id; | ||
END; | ||
$func$ LANGUAGE plpgsql; | ||
|
||
FOR technical_review_loop_var IN | ||
SELECT technical_review_id FROM technical_review | ||
LOOP | ||
UPDATE technical_review SET questionary_id = CreateTechnicalReviewQuestionary(technical_review_template_id_var) WHERE technical_review_id = technical_review_loop_var; | ||
END LOOP; | ||
|
||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
30 changes: 30 additions & 0 deletions
30
apps/backend/db_patches/0165_AddViewForGenericTemplates.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('AddViewForGenericTemplates.sql', 'ellenwright', 'Add new view for generic templates', '2024-11-13') THEN | ||
BEGIN | ||
|
||
CREATE VIEW generic_templates_view as select | ||
g.generic_template_id as generic_template_id, g.title, g.creator_id, g.proposal_pk, g.questionary_id, g.question_id, g.created_at, | ||
fr.user_id as fap_reviewer, | ||
fc.user_id as fap_chair, | ||
fs.user_id as fap_secretary, | ||
i.manager_user_id as instrument_manager, | ||
ihs.user_id as scientist_on_proposal, | ||
vu.user_id as visitor | ||
|
||
from generic_templates g | ||
left join visits v on v.proposal_pk = g.proposal_pk | ||
left join visits_has_users vu on vu.visit_id = v.visit_id | ||
left join fap_reviews fr on fr.proposal_pk = g.proposal_pk | ||
left join fap_chairs fc on fc.fap_id = fr.fap_id | ||
left join fap_secretaries fs on fs.fap_id = fr.fap_id | ||
left join instrument_has_proposals ihp on ihp.proposal_pk = g.proposal_pk | ||
left join instrument_has_scientists ihs on ihs.instrument_id = ihp.instrument_id | ||
left join instruments i on i.instrument_id = ihp.instrument_id; | ||
|
||
END; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
23 changes: 23 additions & 0 deletions
23
apps/backend/db_patches/0166_AddProposalInternalComments.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0166_AddProposalInternalCommentTable.sql', 'Farai Mutambara', 'Adding proposal internal comment table', '2024-11-29') THEN | ||
BEGIN | ||
CREATE TABLE IF NOT EXISTS proposal_internal_comments ( | ||
comment_id SERIAL, | ||
proposal_pk INT REFERENCES proposals(proposal_pk) ON DELETE CASCADE, | ||
comment TEXT NOT NULL, | ||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
PRIMARY KEY (comment_id, proposal_pk) | ||
); | ||
|
||
CREATE TRIGGER set_timestamp | ||
BEFORE UPDATE ON proposal_internal_comments | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE trigger_set_timestamp(); | ||
|
||
END; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
57 changes: 57 additions & 0 deletions
57
apps/backend/db_patches/0166_UpdateWhichCommentOnReviewProposalView.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0166_UpdateWhichCommentOnReviewProposalView.sql', 'Thomas Cottee Meldrum', 'Update review column in the view', '2024-12-03') THEN | ||
|
||
CREATE OR REPLACE VIEW review_data AS | ||
SELECT proposal.proposal_pk, | ||
proposal.proposal_id, | ||
proposal.title, | ||
proposal.instrument_name, | ||
proposal.availability_time, | ||
proposal.time_allocation, | ||
proposal.fap_id, | ||
proposal.rank_order, | ||
proposal.call_id, | ||
proposal.proposer_id, | ||
proposal.instrument_id, | ||
proposal.fap_time_allocation, | ||
proposal.questionary_id, | ||
grade.avg AS average_grade, | ||
proposal.public_comment as comment | ||
from ( | ||
Select | ||
fp.proposal_pk, | ||
p.proposal_id, | ||
p.title, | ||
i.name as instrument_name, | ||
chi.availability_time, | ||
tr.time_allocation, | ||
f.fap_id, | ||
fmd.rank_order, | ||
c.call_id, | ||
p.proposer_id, | ||
i.instrument_id, | ||
fp.fap_time_allocation, | ||
p.questionary_id, | ||
tr.public_comment | ||
from fap_proposals as fp | ||
join faps as f on f.fap_id = fp.fap_id | ||
join call c on c.call_id = fp.call_id | ||
join proposals p on p.proposal_pk = fp.proposal_pk | ||
join technical_review tr on tr.proposal_pk = p.proposal_pk and tr.instrument_id = fp.instrument_id | ||
left join fap_meeting_decisions as fmd on fmd.proposal_pk = p.proposal_pk | ||
join call_has_instruments as chi on chi.instrument_id = fp.instrument_id and chi.call_id = c.call_id | ||
join instruments as i on i.instrument_id = chi.instrument_id | ||
where p.status_id <> 9 and p.status_id <> 1 /* EXPIRED OR DRAFT*/ | ||
) as proposal | ||
left join ( | ||
Select fr.proposal_pk, AVG(fr.grade) from | ||
fap_proposals as fp | ||
join fap_reviews as fr on fr.proposal_pk = fp.proposal_pk | ||
group by fr.proposal_pk | ||
) as grade on grade.proposal_pk = proposal.proposal_pk; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0167_CreateInviteCode', 'Jekabs Karklins', 'Adding tables for invites', '2024-12-03') THEN | ||
BEGIN | ||
|
||
CREATE TABLE invite_codes ( | ||
invite_code_id SERIAL PRIMARY KEY, | ||
code VARCHAR(12) NOT NULL UNIQUE, | ||
email VARCHAR(255) NOT NULL, | ||
note TEXT DEFAULT '', | ||
created_by INT NOT NULL REFERENCES users(user_id), | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
claimed_by INT REFERENCES users(user_id), | ||
claimed_at TIMESTAMPTZ | ||
); | ||
CREATE INDEX invite_codes_code_idx ON invite_codes(code); | ||
|
||
CREATE TABLE role_invites ( | ||
role_invite_id SERIAL PRIMARY KEY, | ||
invite_code_id INT NOT NULL REFERENCES invite_codes(invite_code_id) ON DELETE CASCADE, | ||
role_id INT NOT NULL REFERENCES roles(role_id) ON DELETE CASCADE | ||
); | ||
CREATE INDEX role_invites_invite_code_id_idx ON role_invites(invite_code_id); | ||
|
||
END; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0168_CreateCoProposerInvite', 'Jekabs Karklins', 'Adding co-proposer claims', '2025-01-10') THEN | ||
BEGIN | ||
CREATE TABLE IF NOT EXISTS co_proposer_invites ( | ||
invite_code_id INT NOT NULL REFERENCES invite_codes(invite_code_id) ON DELETE CASCADE, | ||
proposal_pk INT NOT NULL REFERENCES proposals(proposal_pk) ON DELETE CASCADE, | ||
PRIMARY KEY (invite_code_id, proposal_pk)); | ||
END; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0168_XpressEmailSetting.sql', 'Chi Kai Lam', 'Xpress email setting for recipients SAMPLE_SAFETY_EMAIL', '2025-01-24') THEN | ||
BEGIN | ||
INSERT INTO settings (settings_id, settings_value, description) VALUES ('SAMPLE_SAFETY_EMAIL', '', 'Email address for the sample safety team.'); | ||
END; | ||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
Oops, something went wrong.