Skip to content

Commit 3542758

Browse files
authored
feat: Toggle flows offline when setting team status to trial (#712)
1 parent 9eb8aa4 commit 3542758

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/requests/team.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,22 +445,31 @@ async function updateTeamSettings(
445445
gql`
446446
mutation UpdateTeamSettings(
447447
$team_id: Int
448-
$teamSettings: team_settings_set_input!
448+
$team_settings: team_settings_set_input!
449+
$toggle_flows_offline: Boolean!
449450
) {
450451
update_team_settings(
451452
where: { team_id: { _eq: $team_id } }
452-
_set: $teamSettings
453+
_set: $team_settings
453454
) {
454455
returning {
455456
team_id
456457
id
457458
}
458459
}
460+
461+
# If a team is marked as "trial", toggle all flows offline
462+
update_flows(
463+
where: { team_id: { _eq: $team_id } }
464+
_set: { status: offline }
465+
) @include(if: $toggle_flows_offline) {
466+
affected_rows
467+
}
459468
}
460469
`,
461470
{
462471
team_id: teamId,
463-
teamSettings: {
472+
team_settings: {
464473
boundary_url: teamSettings.boundaryUrl,
465474
boundary_bbox: teamSettings.boundaryBBox,
466475
reference_code: teamSettings.referenceCode,
@@ -472,6 +481,7 @@ async function updateTeamSettings(
472481
submission_email: teamSettings.submissionEmail,
473482
is_trial: teamSettings.isTrial,
474483
},
484+
toggle_flows_offline: teamSettings.isTrial,
475485
},
476486
);
477487

0 commit comments

Comments
 (0)