refactor: Rename createActionStepAfterStepId as createAfterStep for flow
This commit is contained in:
@@ -6,7 +6,7 @@ export default async (request, response) => {
|
|||||||
.findById(request.params.flowId)
|
.findById(request.params.flowId)
|
||||||
.throwIfNotFound();
|
.throwIfNotFound();
|
||||||
|
|
||||||
const createdActionStep = await flow.createActionStepAfterStepId(
|
const createdActionStep = await flow.createStepAfter(
|
||||||
request.body.previousStepId
|
request.body.previousStepId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -176,7 +176,7 @@ class Flow extends Base {
|
|||||||
return await Promise.all(stepPositionUpdates);
|
return await Promise.all(stepPositionUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
async createActionStepAfterStepId(previousStepId) {
|
async createStepAfter(previousStepId) {
|
||||||
const previousStep = await this.getStepById(previousStepId);
|
const previousStep = await this.getStepById(previousStepId);
|
||||||
|
|
||||||
const nextSteps = await this.getStepsAfterPosition(previousStep.position);
|
const nextSteps = await this.getStepsAfterPosition(previousStep.position);
|
||||||
|
@@ -248,13 +248,13 @@ describe('Flow model', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('createActionStepAfterStep should create an action step after given step ID', async () => {
|
it('createStepAfter should create an action step after given step ID', async () => {
|
||||||
const flow = await createFlow();
|
const flow = await createFlow();
|
||||||
|
|
||||||
const triggerStep = await createStep({ type: 'trigger', flowId: flow.id });
|
const triggerStep = await createStep({ type: 'trigger', flowId: flow.id });
|
||||||
const actionStep = await createStep({ type: 'action', flowId: flow.id });
|
const actionStep = await createStep({ type: 'action', flowId: flow.id });
|
||||||
|
|
||||||
const createdStep = await flow.createActionStepAfterStepId(triggerStep.id);
|
const createdStep = await flow.createStepAfter(triggerStep.id);
|
||||||
|
|
||||||
const refetchedActionStep = await actionStep.$query();
|
const refetchedActionStep = await actionStep.$query();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user