feat: refactor verify connection mutation with the REST API endpoint

This commit is contained in:
kasia.oczkowska
2024-09-20 13:05:21 +01:00
committed by Ali BARIN
parent dc0273148c
commit 4d5fc50f1a
8 changed files with 37 additions and 92 deletions

View File

@@ -1,8 +1,3 @@
// Converted mutations
import verifyConnection from './mutations/verify-connection.js';
const mutationResolvers = {
verifyConnection,
};
const mutationResolvers = {};
export default mutationResolvers;

View File

@@ -1,29 +0,0 @@
import App from '../../models/app.js';
import globalVariable from '../../helpers/global-variable.js';
const verifyConnection = async (_parent, params, context) => {
context.currentUser.can('create', 'Connection');
let connection = await context.currentUser
.$relatedQuery('connections')
.findOne({
id: params.input.id,
})
.throwIfNotFound();
const app = await App.findOneByKey(connection.key);
const $ = await globalVariable({ connection, app });
await app.auth.verifyCredentials($);
connection = await connection.$query().patchAndFetch({
verified: true,
draft: false,
});
return {
...connection,
app,
};
};
export default verifyConnection;

View File

@@ -3,7 +3,7 @@ type Query {
}
type Mutation {
verifyConnection(input: VerifyConnectionInput): Connection
placeholderQuery(name: String): Boolean
}
type Trigger {
@@ -184,10 +184,6 @@ type SamlAuthProvidersRoleMapping {
remoteRoleName: String
}
input VerifyConnectionInput {
id: String!
}
input UserRoleInput {
id: String
}