feat: Convert all mutation files to js
This commit is contained in:
22
packages/backend/src/graphql/mutations/reset-connection.js
Normal file
22
packages/backend/src/graphql/mutations/reset-connection.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const resetConnection = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Connection');
|
||||
|
||||
let connection = await context.currentUser
|
||||
.$relatedQuery('connections')
|
||||
.findOne({
|
||||
id: params.input.id,
|
||||
})
|
||||
.throwIfNotFound();
|
||||
|
||||
if (!connection.formattedData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
connection = await connection.$query().patchAndFetch({
|
||||
formattedData: { screenName: connection.formattedData.screenName },
|
||||
});
|
||||
|
||||
return connection;
|
||||
};
|
||||
|
||||
export default resetConnection;
|
Reference in New Issue
Block a user