cleanup and prep for admin delete function

This commit is contained in:
lingdocs 2021-08-25 13:15:54 +04:00
parent 0195429f92
commit e2a89f0798
3 changed files with 1 additions and 3 deletions

View File

@ -63,6 +63,7 @@ export async function insertLingdocsUser(user: T.LingdocsUser): Promise<T.Lingdo
export async function deleteLingdocsUser(uuid: T.UUID): Promise<void> {
const user = await getLingdocsUser("userId", uuid);
await deleteCouchDbAuthUser(uuid);
if (!user) return;
// TODO: cleanup userdbs etc
// TODO: Better type certainty here... obviously there is an _id and _rev here

View File

@ -78,6 +78,5 @@ LingDocs Admin`;
export async function sendUpgradeRequestToAdmin(userWantingToUpgrade: T.LingdocsUser) {
const subject = "Account Upgrade Request";
const content = `${userWantingToUpgrade.name} - ${userWantingToUpgrade.email} - ${userWantingToUpgrade.userId} is requesting to upgrade to student.`;
console.log("sending notice of upgrade request to ", adminAddress);
await sendEmail(adminAddress, subject, content);
}

View File

@ -161,8 +161,6 @@ apiRouter.post("/user/upgradeToStudentRequest", async (req, res, next) => {
apiRouter.delete("/user", async (req, res, next) => {
try {
if (!req.user) throw new Error("user not found");
// await deleteWordlistDatabase(req.user.userId);
await deleteCouchDbAuthUser(req.user.userId);
await deleteLingdocsUser(req.user.userId);
sendResponse(res, { ok: true, message: "user deleted" });
} catch (e) {