Skip to content

Commit

Permalink
draft: Adding Flow Name to Editor Files (#3246)
Browse files Browse the repository at this point in the history
Co-authored-by: Rory Doak <[email protected]>
Co-authored-by: Jessica McInchak <[email protected]>
  • Loading branch information
3 people authored Jun 13, 2024
1 parent f936014 commit 518014f
Show file tree
Hide file tree
Showing 31 changed files with 187 additions and 116 deletions.
6 changes: 6 additions & 0 deletions api.planx.uk/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { $public, getClient } from "./client";

export interface FlowData {
slug: string;
name: string;
data: Flow["data"];
team_id: number;
team: { slug: string };
Expand All @@ -28,6 +29,7 @@ const getFlowData = async (id: string): Promise<FlowData> => {
flow: flows_by_pk(id: $id) {
slug
data
name
team_id
team {
slug
Expand Down Expand Up @@ -62,6 +64,7 @@ interface InsertFlow {
const insertFlow = async (
teamId: number,
slug: string,
name: string,
flowData: Flow["data"],
creatorId?: number,
copiedFrom?: Flow["id"],
Expand All @@ -75,6 +78,7 @@ const insertFlow = async (
mutation InsertFlow(
$team_id: Int!
$slug: String!
$name: String!
$data: jsonb = {}
$creator_id: Int
$copied_from: uuid
Expand All @@ -83,6 +87,7 @@ const insertFlow = async (
object: {
team_id: $team_id
slug: $slug
name: $name
data: $data
version: 1
creator_id: $creator_id
Expand All @@ -96,6 +101,7 @@ const insertFlow = async (
{
team_id: teamId,
slug: slug,
name: name,
data: flowData,
creator_id: creatorId,
copied_from: copiedFrom,
Expand Down
2 changes: 2 additions & 0 deletions api.planx.uk/modules/flows/copyFlow/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ const copyFlow = async (
// Check if copied flow data should be inserted into `flows` table, or just returned for reference
if (insert) {
const newSlug = flow.slug + "-copy";
const newName = flow.name + " (copy)";
const creatorId = userContext.getStore()?.user?.sub;
if (!creatorId) throw Error("User details missing from request");

// Insert the flow and an associated operation
await insertFlow(
flow.team_id,
newSlug,
newName,
uniqueFlowData,
parseInt(creatorId),
flowId,
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
40 changes: 18 additions & 22 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
40 changes: 18 additions & 22 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion e2e/tests/api-driven/src/flowStatusHistory/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ Before<CustomWorld>("@flow-status-history", async function () {
});

Given<CustomWorld>("a flow exists", async function () {
const flowId = await createFlow({ teamId: this.teamId, slug: "test-flow" });
const flowId = await createFlow({
teamId: this.teamId,
slug: "test-flow",
name: "Test Flow",
});

assert.ok(flowId, "flowId is not defined");

Expand Down
1 change: 1 addition & 0 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export async function buildITPFlow({
const flowId: string = await $admin.flow.create({
teamId,
slug: `test-invite-to-pay-flow-with-send-to-${destination.toLowerCase()}`,
name: `Test invite to pay flow with send to ${destination}`,
status: "online",
data: flowGraph,
});
Expand Down
2 changes: 2 additions & 0 deletions e2e/tests/api-driven/src/permissions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const setup = async () => {
const team1FlowId = await createFlow({
teamId: teamId1,
slug: "team-1-flow",
name: "Team 1 Flow",
});

const user2Id = await createUser({
Expand All @@ -44,6 +45,7 @@ export const setup = async () => {
const team2FlowId = await createFlow({
teamId: teamId2,
slug: "team-2-flow",
name: "Team 2 Flow",
});

const world = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/src/permissions/queries/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const UPDATE_FLOW_QUERY = gql`
mutation UpdateFlowE2E($team1FlowId: uuid!) {
result: update_flows_by_pk(
pk_columns: { id: $team1FlowId }
_set: { slug: "new-slug" }
_set: { slug: "new-slug", name: "new Name" }
) {
id
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
Loading

0 comments on commit 518014f

Please sign in to comment.