rutilus-analytics-node-js
Version:
Provides a GUI web app that allows users to examine their data in detail. Includes CSV export functionality.
43 lines (34 loc) • 753 B
JavaScript
/**
* Rutilus
*
* @homepage https://gmrutilus.github.io
* @license Apache-2.0
*/
/**
* Contains the route used to delete an account
*/
/** @module */
module.exports = /** @param {KoaCtx} ctx */ async (ctx) => {
const {
errorHandler,
schemas,
} = ctx.res;
const {
email,
} = ctx.params;
await new Promise((resolve) => {
schemas.Accounts.remove({ _id: email }, (err) => {
if (err) {
ctx.body = {
deleted: 0,
error: errorHandler.dbErrorCatcher(err),
};
return;
}
ctx.body = {
deleted: 1,
};
resolve();
});
});
};