chore: remove redundant generate auth url mutation

This commit is contained in:
Ali BARIN
2024-09-24 09:46:56 +00:00
parent 7dcfb1081b
commit 37c78e6bbd
5 changed files with 2 additions and 61 deletions

View File

@@ -1,11 +1,9 @@
// Converted mutations
import verifyConnection from './mutations/verify-connection.js';
import generateAuthUrl from './mutations/generate-auth-url.js';
import resetConnection from './mutations/reset-connection.js';
import updateConnection from './mutations/update-connection.js';
const mutationResolvers = {
generateAuthUrl,
resetConnection,
updateConnection,
verifyConnection,

View File

@@ -1,30 +0,0 @@
import globalVariable from '../../helpers/global-variable.js';
import App from '../../models/app.js';
const generateAuthUrl = async (_parent, params, context) => {
context.currentUser.can('create', 'Connection');
const connection = await context.currentUser
.$relatedQuery('connections')
.findOne({
id: params.input.id,
})
.throwIfNotFound();
if (!connection.formattedData) {
return null;
}
const authInstance = (
await import(`../../apps/${connection.key}/auth/index.js`)
).default;
const app = await App.findOneByKey(connection.key);
const $ = await globalVariable({ connection, app });
await authInstance.generateAuthUrl($);
return connection.formattedData;
};
export default generateAuthUrl;

View File

@@ -1,23 +1,13 @@
type Query {
placeholderQuery(name: String): Boolean
}
type Mutation {
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
resetConnection(input: ResetConnectionInput): Connection
updateConnection(input: UpdateConnectionInput): Connection
verifyConnection(input: VerifyConnectionInput): Connection
}
"""
Exposes a URL that specifies the behaviour of this scalar.
"""
directive @specifiedBy(
"""
The URL that specifies the behaviour of this scalar.
"""
url: String!
) on SCALAR
type Trigger {
name: String
key: String
@@ -130,10 +120,6 @@ type AuthenticationStepProperty {
value: String
}
type AuthLink {
url: String
}
type Connection {
id: String
key: String
@@ -200,10 +186,6 @@ type SamlAuthProvidersRoleMapping {
remoteRoleName: String
}
input GenerateAuthUrlInput {
id: String!
}
input UpdateConnectionInput {
id: String!
formattedData: JSONObject