feat: write POST /v1/connections/:connectionId/reset

This commit is contained in:
Ali BARIN
2024-08-28 16:14:37 +00:00
parent d5c81c14f5
commit c7babf227c
5 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { renderObject } from '../../../../helpers/renderer.js';
export default async (request, response) => {
let connection = await request.currentUser
.$relatedQuery('connections')
.findOne({
id: request.params.connectionId,
})
.throwIfNotFound();
if (!connection.formattedData) {
return renderObject(response, connection);
}
connection = await connection.$query().patchAndFetch({
formattedData: { screenName: connection.formattedData.screenName },
});
renderObject(response, connection);
};