refactor: remove app field out of createConnection

This commit is contained in:
Ali BARIN
2022-07-27 16:01:19 +02:00
parent 70d59c6c64
commit 58d5847eed

View File

@@ -1,4 +1,3 @@
import App from '../../models/app';
import Context from '../../types/express/context';
import { IJSONObject } from '@automatisch/types';
@@ -13,19 +12,12 @@ const createConnection = async (
params: Params,
context: Context
) => {
const app = App.findOneByKey(params.input.key);
const connection = await context.currentUser
return await context.currentUser
.$relatedQuery('connections')
.insert({
key: params.input.key,
formattedData: params.input.formattedData,
});
return {
...connection,
app,
};
};
export default createConnection;