chore: remove redundant update connection mutation

This commit is contained in:
Ali BARIN
2024-09-24 11:10:56 +00:00
parent 24d09fda4c
commit bc0e18d074
5 changed files with 4 additions and 56 deletions

View File

@@ -1,11 +1,14 @@
// Converted mutations // Converted mutations
import verifyConnection from './mutations/verify-connection.js'; import verifyConnection from './mutations/verify-connection.js';
import resetConnection from './mutations/reset-connection.js'; import resetConnection from './mutations/reset-connection.js';
import updateConnection from './mutations/update-connection.js';
const mutationResolvers = { const mutationResolvers = {
resetConnection, resetConnection,
<<<<<<< HEAD
updateConnection, updateConnection,
=======
updateCurrentUser,
>>>>>>> 82cde73e (chore: remove redundant update connection mutation)
verifyConnection, verifyConnection,
}; };

View File

@@ -1,33 +0,0 @@
import AppAuthClient from '../../models/app-auth-client.js';
const updateConnection = async (_parent, params, context) => {
context.currentUser.can('create', 'Connection');
let connection = await context.currentUser
.$relatedQuery('connections')
.findOne({
id: params.input.id,
})
.throwIfNotFound();
let formattedData = params.input.formattedData;
if (params.input.appAuthClientId) {
const appAuthClient = await AppAuthClient.query()
.findById(params.input.appAuthClientId)
.throwIfNotFound();
formattedData = appAuthClient.formattedAuthDefaults;
}
connection = await connection.$query().patchAndFetch({
formattedData: {
...connection.formattedData,
...formattedData,
},
});
return connection;
};
export default updateConnection;

View File

@@ -4,7 +4,6 @@ type Query {
type Mutation { type Mutation {
resetConnection(input: ResetConnectionInput): Connection resetConnection(input: ResetConnectionInput): Connection
updateConnection(input: UpdateConnectionInput): Connection
verifyConnection(input: VerifyConnectionInput): Connection verifyConnection(input: VerifyConnectionInput): Connection
} }
@@ -186,12 +185,6 @@ type SamlAuthProvidersRoleMapping {
remoteRoleName: String remoteRoleName: String
} }
input UpdateConnectionInput {
id: String!
formattedData: JSONObject
appAuthClientId: String
}
input ResetConnectionInput { input ResetConnectionInput {
id: String! id: String!
} }

View File

@@ -1,9 +1,7 @@
import { UPDATE_CONNECTION } from './update-connection';
import { VERIFY_CONNECTION } from './verify-connection'; import { VERIFY_CONNECTION } from './verify-connection';
import { RESET_CONNECTION } from './reset-connection'; import { RESET_CONNECTION } from './reset-connection';
const mutations = { const mutations = {
updateConnection: UPDATE_CONNECTION,
verifyConnection: VERIFY_CONNECTION, verifyConnection: VERIFY_CONNECTION,
resetConnection: RESET_CONNECTION, resetConnection: RESET_CONNECTION,
}; };

View File

@@ -1,13 +0,0 @@
import { gql } from '@apollo/client';
export const UPDATE_CONNECTION = gql`
mutation UpdateConnection($input: UpdateConnectionInput) {
updateConnection(input: $input) {
id
key
verified
formattedData {
screenName
}
}
}
`;