slate/scripts/delete-user.js

31 lines
613 B
JavaScript
Raw Normal View History

import configs from "~/knexfile";
import knex from "knex";
import * as Data from "~/node_common/data";
2020-12-08 09:59:46 +03:00
import { deleteUser } from "~/pages/api/users/delete";
const envConfig = configs["development"];
const db = knex(envConfig);
console.log(`RUNNING: delete-user.js`);
const run = async () => {
const user = await Data.getUserByUsername({
username: process.argv[3],
});
console.log(user);
if (user) {
console.log(`deleting ${user.username}`);
2020-12-08 09:59:46 +03:00
await deleteUser(user);
}
console.log(`FINISHED: delete-user.js`);
console.log(` CTRL +C to return to terminal.`);
};
run();