-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update org feature flags backend (#10446)
- Loading branch information
1 parent
89fd195
commit 3b44d51
Showing
37 changed files
with
688 additions
and
165 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import graphql from 'babel-plugin-relay/macro' | ||
import {commitMutation} from 'react-relay' | ||
import {ToggleAIFeaturesMutation as TToggleAIFeaturesMutation} from '../__generated__/ToggleAIFeaturesMutation.graphql' | ||
import {StandardMutation} from '../types/relayMutations' | ||
|
||
graphql` | ||
fragment ToggleAIFeaturesMutation_organization on ToggleAIFeaturesSuccess { | ||
organization { | ||
id | ||
useAI | ||
} | ||
} | ||
` | ||
|
||
const mutation = graphql` | ||
mutation ToggleAIFeaturesMutation($orgId: ID!) { | ||
toggleAIFeatures(orgId: $orgId) { | ||
... on ErrorPayload { | ||
error { | ||
message | ||
} | ||
} | ||
...ToggleAIFeaturesMutation_organization @relay(mask: false) | ||
} | ||
} | ||
` | ||
|
||
const ToggleAIFeaturesMutation: StandardMutation<TToggleAIFeaturesMutation> = ( | ||
atmosphere, | ||
variables, | ||
{onError, onCompleted} | ||
) => { | ||
return commitMutation<TToggleAIFeaturesMutation>(atmosphere, { | ||
mutation, | ||
variables, | ||
onCompleted, | ||
onError | ||
}) | ||
} | ||
|
||
export default ToggleAIFeaturesMutation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import graphql from 'babel-plugin-relay/macro' | ||
import {commitMutation} from 'react-relay' | ||
import {ToggleFeatureFlagMutation as TToggleFeatureFlagMutation} from '../__generated__/ToggleFeatureFlagMutation.graphql' | ||
import {StandardMutation} from '../types/relayMutations' | ||
|
||
graphql` | ||
fragment ToggleFeatureFlagMutation_notification on ToggleFeatureFlagSuccess { | ||
featureFlag { | ||
featureName | ||
enabled | ||
} | ||
} | ||
` | ||
|
||
const mutation = graphql` | ||
mutation ToggleFeatureFlagMutation($featureName: String!, $orgId: ID, $teamId: ID, $userId: ID) { | ||
toggleFeatureFlag(featureName: $featureName, orgId: $orgId, teamId: $teamId, userId: $userId) { | ||
... on ErrorPayload { | ||
error { | ||
message | ||
} | ||
} | ||
...ToggleFeatureFlagMutation_notification @relay(mask: false) | ||
} | ||
} | ||
` | ||
|
||
const ToggleFeatureFlagMutation: StandardMutation<TToggleFeatureFlagMutation> = ( | ||
atmosphere, | ||
variables, | ||
{onError, onCompleted} | ||
) => { | ||
return commitMutation<TToggleFeatureFlagMutation>(atmosphere, { | ||
mutation, | ||
variables, | ||
onCompleted, | ||
onError | ||
}) | ||
} | ||
|
||
export default ToggleFeatureFlagMutation |
Oops, something went wrong.