Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
f2b8a4c
feat: add new workflow data structures and update related data sources
Dec 22, 2025
29ab668
feat: rename and refactor status changing events handling in workflow…
Dec 22, 2025
b18f078
fix: throw error when status changing event is not found in database
Dec 22, 2025
23b55ba
feat: overhaul workflow status handling by renaming and refactoring r…
Dec 22, 2025
9e33025
feat: overhaul workflow data structures and connections by refactorin…
Dec 24, 2025
2d3b0b6
feat: update WorkflowStatus model and related components to use workf…
Dec 29, 2025
a34a1eb
fix: comment out validation schema for deleteWorkflowStatus and add T…
Dec 29, 2025
3cc35a9
feat: refactor workflow connection handling by renaming methods and i…
Dec 29, 2025
e52d957
feat: update WorkflowEditor to use workflowStatusId for source and ta…
Dec 29, 2025
5d30bee
feat: add ON DELETE CASCADE to foreign key constraints in workflow_st…
Dec 29, 2025
26ef94b
fix: update edge identification logic to use connection ID directly
Dec 29, 2025
f9d1e68
feat: overhaul workflow data structures by removing status changing e…
Dec 29, 2025
ccbcb18
feat: rename and update connection status actions mutation to setStat…
Dec 30, 2025
56b3eb1
refactor: update workflow connection action identifiers to use new na…
Dec 30, 2025
110979a
feat: add ON DELETE CASCADE to foreign key constraints in workflow da…
Dec 30, 2025
51cd7a2
feat: add xstate for workflow state management and implement getWorkf…
Dec 30, 2025
8c563af
feat: enhance workflow management by adding workflow status handling …
Dec 31, 2025
af465b5
refactor: rename updateProposalStatus to updateProposalWfStatus for c…
Dec 31, 2025
b7551ab
feat: overhaul workflow guards by implementing IGuard interface and r…
Dec 31, 2025
50cf348
feat: enhance workflow management by adding default workflow status h…
Dec 31, 2025
ad2becb
refactor: remove unused getProposalWorkflowByCallId function and log …
Jan 1, 2026
d21d38b
feat: overhaul workflow management by replacing IGuard interface with…
Jan 1, 2026
bfd5265
refactor: remove guardNames from WorkflowDataSource and related mock …
Jan 1, 2026
72d06a1
feat: implement workflow machine and guards with refactored state man…
Jan 1, 2026
4f2c8af
feat: enhance workflow management by adding guards and refactoring ev…
Jan 2, 2026
05d2f5a
feat: update workflow and status action data sources to use workflowS…
Jan 2, 2026
44fae96
feat: enhance FapQueries to include review data source and implement …
Jan 2, 2026
dfb2811
refactor: remove unused ProposalEventsRecord interface and clean up w…
Jan 6, 2026
8f56861
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Jan 6, 2026
ba5da92
fix: update join table in CallDataSource to use workflow_has_statuses…
Jan 6, 2026
9e359b5
fix: update edge style logic in WorkflowEdge component for better vis…
Jan 6, 2026
12f1d50
fix: adjust edge style in WorkflowEdge component for improved visibility
Jan 6, 2026
d5695b7
feat: implement ProposalWorkflowEngine and integrate into dependency …
Jan 7, 2026
69322c9
Add guards for proposal workflow validation
Jan 9, 2026
bbec4d3
Refactor status handling in experiments and proposals
Jan 13, 2026
0e66af0
refactor: remove shortCode from Status and related data sources
Jan 14, 2026
e14e955
refactor: replace shortCode with id in status-related data structures…
Jan 14, 2026
6d5ead1
refactor: update workflow and status handling to use 'id' instead of …
Jan 15, 2026
5bb81f9
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Jan 15, 2026
ecce077
refactor: update WorkflowEdge and StatusNode to use 'id' instead of '…
Jan 15, 2026
2301406
feat: add sourceHandle and targetHandle to workflow connections and r…
Jan 15, 2026
b427eef
fix: update status_id to use draftWfStatus for accurate workflow stat…
Jan 15, 2026
606d8de
fix: update workflow handling to use 'id' instead of 'shortCode' for …
Jan 15, 2026
79a7d8b
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Jan 16, 2026
64b3c0b
feat: integrate confirmation dialog for status deletion in StatusNode…
Jan 16, 2026
5ea8316
fix: update status handling to replace 'shortCode' with 'statusId' in…
Jan 21, 2026
809fd48
refactor: overhaul workflow handling by replacing StatusDataSource wi…
Jan 22, 2026
af34c88
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Jan 22, 2026
1876021
Refactor workflow status handling in Cypress tests
Jan 26, 2026
445fee0
refactor: update validation schemas in StatusMutations and WorkflowMu…
Jan 26, 2026
13866d9
refactor: enhance event handling by adding guards for proposal and ca…
Jan 27, 2026
e0052f4
refactor: update proposal and status handling by renaming fields and …
Jan 27, 2026
1aaf880
refactor: update status filter values to use descriptive strings inst…
Jan 27, 2026
206ac10
refactor: update EdgeData interface to use status IDs instead of shor…
Jan 27, 2026
5b99b9f
refactor: update duo-validation package to version 6.0.0 in frontend …
Jan 27, 2026
949c1d0
refactor: overhaul workflow management by enhancing status handling, …
Jan 28, 2026
127255c
refactor: update workflow status handling in FAPs tests to use dynami…
Jan 29, 2026
37aa065
refactor: enhance workflow status management in technique proposal te…
Jan 29, 2026
9ef2bc7
refactor: enable technique proposal and advanced tests by removing skip
Jan 29, 2026
bc91909
refactor: update proposal status input IDs to use 'selectedWorkflowSt…
Jan 29, 2026
64d0ba9
refactor: update proposal status handling to use 'selectedWorkflowSta…
Jan 29, 2026
c452215
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Jan 29, 2026
01c669e
refactor: remove 'only' from create Proposal status test to enable ex…
Jan 29, 2026
4bc3edd
refactor: add status to workflow in proposal tests for improved coverage
Jan 29, 2026
97291fd
refactor: update workflow data structures to link proposals and exper…
Jan 29, 2026
2299355
refactor: enhance workflow status handling by adding 'Feasibility' st…
Jan 29, 2026
5aa2107
refactor: add 'Feasibility' status to workflow and integrate into ins…
Jan 29, 2026
db22382
refactor: add updated_at column to workflows and enhance workflow str…
Jan 29, 2026
d51dd3e
refactor: enhance statusName column rendering with clickable link for…
Jan 29, 2026
5999195
refactor: overhaul workflow data structures and integrate workflow st…
Feb 2, 2026
e7add2d
refactor: streamline workflow status handling by removing position pa…
Feb 3, 2026
112c671
refactor: streamline workflow status handling by removing position pa…
Feb 3, 2026
7d5e3c0
Merge branch 'SWAP-4949-workflow-overhaul' of github.com:UserOfficePr…
Feb 3, 2026
1269421
test: enable proposal allocation time unit test
Feb 3, 2026
09b265a
refactor: optimize SQL query for average grade calculation in proposa…
Feb 3, 2026
7ec3f95
fix: add ORDER BY clause to proposal_pk in status migration query
Feb 3, 2026
db48864
refactor: remove unused event bus publishing functions and caching lo…
Feb 3, 2026
61f310b
fix: cleanup
Feb 3, 2026
0879b7a
fix: update workflow status ID reference in settings tests
Feb 3, 2026
255e798
fix: improve error message for connecting statuses from different wor…
Feb 4, 2026
4426e45
refactor: streamline proposal status handling in settings tests
Feb 4, 2026
0165c16
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Feb 7, 2026
e3685bb
refactor: enhance workflow status handling in settings tests
Feb 8, 2026
a44cb1e
feat: add callEnded parameter to updateCall mutation
Feb 8, 2026
4ddee5a
refactor: update workflow status handling and improve notification me…
Feb 8, 2026
a89838d
refactor: skip proposal status update test for conditional checks
Feb 8, 2026
838d807
test: enable only the proposal workflow status removal test
Feb 8, 2026
6fcab29
refactor: update proposalStatusId handling to support 'ALL' filter
Feb 8, 2026
1f94e5d
feat: enhance proposal status update to validate workflow status befo…
Feb 8, 2026
065411f
feat: add new workflow statuses for Instrument Scientist Review and u…
Feb 8, 2026
9d9b35e
refactor: update workflow status identifiers in tests and components
Feb 8, 2026
eb231c6
feat: add 'EDITABLE_SUBMITTED_INTERNAL' status to workflow and adjust…
Feb 8, 2026
58b49f4
feat: update workflow statuses for Instrument Scientist Review and ad…
Feb 9, 2026
bfc8832
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Feb 13, 2026
a0daa99
feat: rename new workflow data structures and migration scripts for i…
Feb 13, 2026
8d7b5f5
fix: enable setting workflow status ID in ExperimentDataSourceMock
Feb 13, 2026
7bf0eae
feat: refactor StfcProposalDataSource to streamline constructor param…
Feb 13, 2026
7f1d48c
feat: rename 'getDefaultStatus' and 'getDefaultWorkflowStatus' to 'ge…
Feb 13, 2026
8245b1c
fix: change access modifiers for callDataSource and statusDataSource …
Feb 13, 2026
814b407
feat: add notes for workflow status handling and update interface for…
Feb 13, 2026
e89e464
refactor: simplify updated proposals type and remove unnecessary chec…
Feb 13, 2026
83e90fd
feat: expand WorkflowRunInput type to include array of WorkflowRunSin…
Feb 13, 2026
3864a49
Merge branch 'develop' into SWAP-4949-workflow-overhaul
yoganandaness Feb 17, 2026
80f1f66
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Feb 19, 2026
ec5051d
refactor: simplify createWorkflowConnection parameters for improved r…
Feb 22, 2026
3822870
refactor: update validation schemas to use string for IDs and improve…
Feb 22, 2026
03cc3f6
refactor: rename variable for initial workflow status in createExperi…
Feb 22, 2026
e244a61
refactor: remove unused StatusDataSourceMock and update proposal mock…
Feb 22, 2026
399a8f4
refactor: rename newStatus to newWorkflowStatus for clarity in logCon…
Feb 22, 2026
cd603ae
refactor: simplify creation of new proposal workflow connection for i…
Feb 22, 2026
8f94c54
refactor: remove xstate dependency from package.json and package-lock…
Feb 22, 2026
8b888c5
refactor: simplify return statement in getStatusEngineReadyProposals …
Feb 22, 2026
32955c0
refactor: remove hover scaling effect from StyledHandle for consistency
Feb 22, 2026
5d97311
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Feb 24, 2026
232760d
refactor: enhance StyledHandle visibility logic based on connection s…
Feb 24, 2026
86e1256
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Mar 3, 2026
8333670
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
yoganandaness Mar 16, 2026
88a2a54
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
yoganandaness Mar 16, 2026
3a7ca72
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
yoganandaness Mar 16, 2026
6108815
Merge branch 'SWAP-4949-workflow-overhaul' of github.com:UserOfficePr…
yoganandaness Mar 20, 2026
c5a49eb
fix failing unit tests
yoganandaness Mar 20, 2026
d9f7830
fixing failing e2e
yoganandaness Mar 20, 2026
9afac60
fixing failed e2e
yoganandaness Mar 20, 2026
bba29a7
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
yoganandaness Mar 20, 2026
7df97cc
Merge branch 'develop' into SWAP-4949-workflow-overhaul
yoganandaness Mar 20, 2026
671e3f6
ix: technique proposal table status handling
yoganandaness Mar 23, 2026
81107b6
Merge branch 'develop' into SWAP-4949-workflow-overhaul
yoganandaness Mar 23, 2026
2b4d729
fix: show proposal ids
Mar 24, 2026
27d2c36
fix: clone proposal bug
Mar 24, 2026
4bdc221
refactor: update event handling in ProposalWorkflowEngine and Actor t…
Mar 26, 2026
c5a3324
fix: correct formatting of warning alert for status change to DRAFT
Mar 26, 2026
359a30e
refactor: streamline state transition tests and enhance guard handling
Mar 26, 2026
79a250f
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Mar 31, 2026
3314913
refactor: rename workflow status connection tables for consistency
Apr 1, 2026
2d95a6d
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Apr 1, 2026
ad9709d
fix: adding check to make sure the migration stops in case of invalid…
Apr 8, 2026
90609df
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Apr 8, 2026
b308e2d
Merge branch 'develop' into SWAP-4949-workflow-overhaul
Apr 12, 2026
dc0e490
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Apr 12, 2026
6b8fe43
refactor: simplify instrument and technique insertion statements in S…
Apr 12, 2026
705b369
Merge branch 'SWAP-4949-workflow-overhaul' of https://github.com/User…
Apr 12, 2026
69e5a02
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Apr 20, 2026
ec0ae14
refactor: update patch name for clarity in RenameShortCodeToStatusId.sql
Apr 20, 2026
4cbaea5
refactor: update addStatusToWorkflow method to use AddStatusToWorkflo…
Apr 20, 2026
7cf294c
refactor: remove updateProposalWfStatus method and replace with chang…
Apr 20, 2026
a7105b3
refactor: streamline migration script by removing redundant pre-check…
Apr 20, 2026
89936ac
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins Apr 20, 2026
074279f
refactor: make workflow structure properties readonly for better immu…
Apr 20, 2026
8fc53f4
Merge branch 'SWAP-4949-workflow-overhaul' of https://github.com/User…
Apr 20, 2026
308c995
refactor: remove obsolete triggers and functions related to workflow …
Apr 21, 2026
638902f
fix: add getStatusByWorkflowStatusId method to StatusDataSource and i…
Apr 21, 2026
00a19c9
fix: remove status_id from proposals
Apr 21, 2026
1632bef
fix: fix tests
Apr 21, 2026
a890877
fix: fix seeds
Apr 22, 2026
89f0df6
fix: include reference to proposal_status
Apr 22, 2026
20f27a4
fix: remove status_id from ExperimentSafety and related data sources
Apr 22, 2026
4453450
fix: skip migration for experiment_safety as it no longer uses status_id
Apr 22, 2026
e2826bb
fix: simplify logic in UserAuthorization and FapQueries, streamline W…
Apr 22, 2026
81daaee
fix: initialize statusId as an empty string in createExperimentSafety…
Apr 22, 2026
38fd5e5
Merge branch 'develop' into SWAP-4949-workflow-overhaul
yoganandaness Apr 27, 2026
63b4247
fix: update guard names
Apr 27, 2026
45e0129
fix: format code for isEveryFapInstrumentMeetingSubmittedForProposalG…
Apr 29, 2026
7a8222a
fix: enable test for updating proposal status multiple times if condi…
Apr 29, 2026
5f6b2e4
fix: rename variables for consistency and clarity in createWorkflowMa…
Apr 29, 2026
cc9dbfe
fix: rename workflow status variables for consistency across Proposal…
Apr 29, 2026
a1d78df
fix: rename draft workflow status variable for consistency in setting…
Apr 29, 2026
e6ef06b
fix: move status creation to beforeEach for Instruments tests to avoi…
Apr 29, 2026
2a0c8f2
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins May 2, 2026
fcf287c
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins May 4, 2026
7e34408
fix: performance tweak
May 4, 2026
cc12911
fix: rename workflow status variables for clarity in WorkflowEditor
May 4, 2026
c44ce5d
fix: clarify comments regarding workflow status removal in WorkflowEd…
May 4, 2026
49164c5
fix: update imports from simpleStateMachine to stateMachine
May 20, 2026
8f0af22
fix: remove unused reducer middleware from WorkflowEditor and Workflo…
May 20, 2026
f41567f
fix: replace hardcoded 'EXPIRED' status with StatusCode.EXPIRED in Te…
May 20, 2026
2abf267
fix: rename type StfcRolesToEssRole to StfcRolesToSystemRole for cons…
May 20, 2026
fb901d5
Merge branch 'develop' into SWAP-4949-workflow-overhaul
May 20, 2026
fd79ace
fix: remove unused dummyProposalEvents and update getStatusByWorkflow…
May 20, 2026
206c2ce
fix: correct import paths for stateMachine module across guards and r…
May 21, 2026
962fcc2
Merge branch 'develop' into SWAP-4949-workflow-overhaul
bolmsten May 22, 2026
6a027af
Merge branch 'develop' into SWAP-4949-workflow-overhaul
jekabs-karklins May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions apps/backend/db_patches/0207_AddNewWorkflowDataStructures.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
DO
$$
BEGIN
IF register_patch(
'Add_new_workflow_data_structures',
'Jekabs Karklins',
'Add new workflow data structures for improved workflow management.',
'2025-12-20'
) THEN
BEGIN

-- ===============================
-- 0) Update workflows table
-- ===============================
ALTER TABLE workflows ADD COLUMN updated_at TIMESTAMPTZ DEFAULT NOW();

-- ===============================
-- 1) workflow_has_statuses
-- ===============================
CREATE TABLE workflow_has_statuses (
workflow_status_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
workflow_id INT NOT NULL,
status_id INT NOT NULL,
pos_x INT NOT NULL DEFAULT 0,
pos_y INT NOT NULL DEFAULT 0,

CONSTRAINT fk_whs_workflow
FOREIGN KEY (workflow_id) REFERENCES workflows (workflow_id),

CONSTRAINT fk_whs_status
FOREIGN KEY (status_id) REFERENCES statuses (status_id)
);

-- (1) Make (workflow_id, workflow_status_id) uniquely addressable so we can
-- use it as a composite FK target from transitions.
ALTER TABLE workflow_has_statuses
ADD CONSTRAINT uq_whs_workflow_and_state UNIQUE (workflow_id, workflow_status_id);



-- ===============================
-- 2) workflow_status_connections
-- ===============================
CREATE TABLE workflow_status_connections (
workflow_status_connection_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
workflow_id INT NOT NULL,
prev_workflow_status_id INT NOT NULL,
next_workflow_status_id INT NOT NULL,
source_handle VARCHAR(255) NOT NULL DEFAULT 'bottom-source',
target_handle VARCHAR(255) NOT NULL DEFAULT 'top-target',

CONSTRAINT fk_wsc_workflow
FOREIGN KEY (workflow_id) REFERENCES workflows (workflow_id),

-- (1) Enforce that prev/next states belong to the same workflow by referencing
-- the composite key on workflow_has_statuses.
CONSTRAINT fk_wsc_prev_state
FOREIGN KEY (workflow_id, prev_workflow_status_id)
REFERENCES workflow_has_statuses (workflow_id, workflow_status_id)
ON DELETE CASCADE,

CONSTRAINT fk_wsc_next_state
FOREIGN KEY (workflow_id, next_workflow_status_id)
REFERENCES workflow_has_statuses (workflow_id, workflow_status_id)
ON DELETE CASCADE
);

-- (2) Prevent duplicate edges within a workflow.
ALTER TABLE workflow_status_connections
ADD CONSTRAINT uq_wsc_edge UNIQUE (workflow_id, prev_workflow_status_id, next_workflow_status_id);


-- =====================================================================
-- 4) workflow_status_connection_has_events (edge→events)
-- =====================================================================
CREATE TABLE workflow_status_connection_has_events (
workflow_status_connection_id BIGINT NOT NULL,
status_changing_event TEXT NOT NULL,

CONSTRAINT pk_wsc_has_events
PRIMARY KEY (workflow_status_connection_id, status_changing_event),

CONSTRAINT fk_wsche_connection
FOREIGN KEY (workflow_status_connection_id)
REFERENCES workflow_status_connections (workflow_status_connection_id)
ON DELETE CASCADE
);

-- The composite PK already prevents duplicates for (connection, event).


-- Rename existing status_actions table to workflow_status_actions
ALTER TABLE status_actions RENAME TO workflow_status_actions;
ALTER table workflow_status_actions
RENAME COLUMN status_action_id TO workflow_status_action_id;

-- ==========================================================
-- 5) workflow_status_connection_has_actions (edge→actions)
-- ==========================================================
CREATE TABLE workflow_status_connection_has_actions (
workflow_status_connection_id INT NOT NULL,
workflow_status_action_id INT NOT NULL,
workflow_id INT NOT NULL,
config JSONB,

CONSTRAINT pk_wsc_has_actions
PRIMARY KEY (workflow_status_connection_id, workflow_status_action_id),

CONSTRAINT fk_wsca_workflow
FOREIGN KEY (workflow_id)
REFERENCES workflows (workflow_id),

CONSTRAINT fk_wsca_connection
FOREIGN KEY (workflow_status_connection_id)
REFERENCES workflow_status_connections (workflow_status_connection_id)
ON DELETE CASCADE,

CONSTRAINT fk_wsca_action
FOREIGN KEY (workflow_status_action_id)
REFERENCES workflow_status_actions (workflow_status_action_id)
);

-- ==================================================================
-- 7) Link proposals and experiment_safety to the new workflow graph
-- ==================================================================
ALTER TABLE proposals
ADD COLUMN workflow_status_id INT NULL;

ALTER TABLE proposals
ADD CONSTRAINT fk_proposals_workflow_status
FOREIGN KEY (workflow_status_id)
REFERENCES workflow_has_statuses (workflow_status_id);

ALTER TABLE experiment_safety
ADD COLUMN workflow_status_id INT NULL;

ALTER TABLE experiment_safety
ADD CONSTRAINT fk_experiment_safety_workflow_status
FOREIGN KEY (workflow_status_id)
REFERENCES workflow_has_statuses (workflow_status_id);

END;
END IF;
END;
$$
LANGUAGE plpgsql;
Loading
Loading