feat: Implement rest API endpoint to update connection

This commit is contained in:
Faruk AYDIN
2024-09-16 12:55:39 +03:00
parent 167195a01c
commit 34aadbfb09
6 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { renderObject } from '../../../../helpers/renderer.js';
export default async (request, response) => {
let connection = await request.currentUser
.$relatedQuery('connections')
.findOne({
id: request.params.connectionId,
})
.throwIfNotFound();
connection = await connection.update(connectionParams(request));
renderObject(response, connection);
};
const connectionParams = (request) => {
const { formattedData, appAuthClientId } = request.body;
return { formattedData, appAuthClientId };
};