refactor: Use input params for all mutations
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
212523aec6
commit
bb36748764
@@ -3,21 +3,23 @@ import Context from '../../types/express/context';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
type Params = {
|
||||
key: string;
|
||||
formattedData: IJSONObject;
|
||||
input: {
|
||||
key: string;
|
||||
formattedData: IJSONObject;
|
||||
};
|
||||
};
|
||||
const createConnection = async (
|
||||
_parent: unknown,
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
const app = App.findOneByKey(params.key);
|
||||
const app = App.findOneByKey(params.input.key);
|
||||
|
||||
const connection = await context.currentUser
|
||||
.$relatedQuery('connections')
|
||||
.insert({
|
||||
key: params.key,
|
||||
formattedData: params.formattedData,
|
||||
key: params.input.key,
|
||||
formattedData: params.input.formattedData,
|
||||
});
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user