feat: Convert all mutation files to js

This commit is contained in:
Faruk AYDIN
2023-12-28 13:53:16 +01:00
parent 47dd5a1949
commit 8d6f0f8e9e
42 changed files with 229 additions and 706 deletions

View File

@@ -0,0 +1,28 @@
import globalVariable from '../../helpers/global-variable';
import App from '../../models/app';
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`))
.default;
const app = await App.findOneByKey(connection.key);
const $ = await globalVariable({ connection, app });
await authInstance.generateAuthUrl($);
return connection.formattedData;
};
export default generateAuthUrl;