feat: write POST /v1/connections/:connectionId/reset
This commit is contained in:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user