cleanup and prep for admin delete function
This commit is contained in:
parent
0195429f92
commit
e2a89f0798
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue