adds method to get libp2p tokens back when user accounts are deleted from Slate

This commit is contained in:
jimmylee 2020-11-17 00:03:38 -08:00
parent 36ebf5a823
commit 83ba2b6a85
2 changed files with 18 additions and 5 deletions

View File

@ -69,12 +69,17 @@ import getEverySlate from "~/node_common/data/methods/get-every-slate";
import getEveryUser from "~/node_common/data/methods/get-every-user";
// NOTE(jim):
// Deals
// one-offs
import getAllDeals from "~/node_common/data/methods/get-all-deals";
import createOrUpdateStats from "~/node_common/data/methods/create-or-update-stats";
import createOrphan from "~/node_common/data/methods/create-orphan";
export {
// NOTE(jim): One-offs
createOrUpdateStats,
createOrphan,
getAllDeals,
// NOTE(jim): User operations.
// NOTE(jim): User operations
createUser,
updateUserById,
deleteUserByUsername,
@ -84,7 +89,7 @@ export {
getPendingDataForUserId,
deletePendingDataByUserId,
createPendingData,
// NOTE(jim): Slate operations.
// NOTE(jim): Slate operations
createSlate,
getSlateByName,
getSlateById,
@ -94,14 +99,14 @@ export {
deleteSlatesForUserId,
deleteSlateById,
deleteRepostsByCid,
// NOTE(jim): API key operations,
// NOTE(jim): API key operations
createAPIKeyForUserId,
deleteAPIKeyById,
deleteAPIKeysForUserId,
getAPIKey,
getAPIKeyByKey,
getAPIKeysByUserId,
// NOTE(jim): Subscription operations,
// NOTE(jim): Subscription operations
createSubscription,
getSubscriptionById,
getSubscriptionsByUserId,

View File

@ -62,6 +62,14 @@ export default async (req, res) => {
SearchManager.updateUser(user, "REMOVE");
// NOTE(jim): Creates an orphan to preserve the libp2p token
// Incase we need to retrieve Filecoin from it.
/*
await Data.createOrphan({
data: { token: user.data.tokens.api },
});
*/
const deleted = await Data.deleteUserByUsername({
username: user.username,
});