Skip to content

Commit

Permalink
feat(api): change control dto structure (#5900)
Browse files Browse the repository at this point in the history
  • Loading branch information
djabarovgeorge authored Jul 1, 2024
1 parent 30df5d4 commit 3e776cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/app/events/e2e/bridge-trigger.e2e-ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ contexts.forEach((context: Context) => {
await saveControlVariables(session, workflowId, stepId, { variables: { name: 'stored_control_name' } });
}

const controls = { controls: { step: [{ stepId: stepId, name: 'stored_control_name' }] } };
const controls = { controls: { step: { [stepId]: { name: 'stored_control_name' } } } };
await triggerEvent(session, workflowId, subscriber, controls, bridge);
await session.awaitRunningJobs();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ export class SubscriberJobBound {
...bridgeWorkflow,
type: 'ECHO',
steps: bridgeWorkflow.steps.map((step) => {
const stepControlVariables = command.payload.controls?.[ControlVariablesLevelEnum.STEP_CONTROLS].find(
(control) => control.stepId === step.stepId
);
const stepControlVariables = command.payload.controls?.[ControlVariablesLevelEnum.STEP_CONTROLS]?.[step.stepId];

return {
...step,
Expand Down
8 changes: 6 additions & 2 deletions libs/shared/src/dto/controls/controls.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { ControlVariablesLevelEnum } from '../../types';

export type ControlsDto = Record<ControlVariablesLevelEnum, Control[]>;
type Control = { stepId: string } & Record<string, unknown>;
export type ControlsDto = {
[K in ControlVariablesLevelEnum]?: StepControl;
};
type StepControl = Record<stepId, Data>;
type stepId = string;
type Data = Record<string, unknown>;

0 comments on commit 3e776cd

Please sign in to comment.