Skip to content

Commit

Permalink
[keyserver] delete all fc channel tags
Browse files Browse the repository at this point in the history
Summary: i had tagged a bunch of communities with farcaster channels and needed a way to remove the tags in a way that not only clean up my keyserver but also clean up dynamodb and s3. this script may be helpful to others, so putting up a diff

Test Plan: successfully removed all the farcaster tags i had created from my mariadb communities table, ddb, and s3

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13638
  • Loading branch information
vdhanan committed Oct 9, 2024
1 parent 3be5aa3 commit 655a029
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions keyserver/src/scripts/delete-all-fc-channel-tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @flow

import { main } from './utils.js';
import { deleteFarcasterChannelTag } from '../deleters/farcaster-channel-tag-deleters.js';
import { fetchAllCommunityInfosWithNames } from '../fetchers/community-fetchers.js';
import { createScriptViewer } from '../session/scripts.js';
import { thisKeyserverAdmin } from '../user/identity.js';

async function deleteAllFCChannelTags() {
const admin = await thisKeyserverAdmin();
const adminViewer = createScriptViewer(admin.id);

const allCommunityInfosWithNames = await fetchAllCommunityInfosWithNames();

const deleteFarcasterChannelTagPromises = allCommunityInfosWithNames
.map(communityInfoWithName => {
if (!communityInfoWithName.farcasterChannelID) {
return null;
}
return deleteFarcasterChannelTag(adminViewer, {
commCommunityID: communityInfoWithName.id,
farcasterChannelID: communityInfoWithName.farcasterChannelID,
});
})
.filter(Boolean);
await Promise.all(deleteFarcasterChannelTagPromises);
}

main([deleteAllFCChannelTags]);

0 comments on commit 655a029

Please sign in to comment.