@beyond-agentur-ug/firebase-delete-inactive-users
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

firebase-delete-inactive-users

Handy function to delete old unused firebase accounts

How many user should be deleted at once?

You should be fine deleting 15k users in a run. Therefore please use 2G RAM and execution time of 540 seconds for the cloud function.

Install

npm i --save @beyond-agentur-ug/firebase-delete-inactive-users

Example use:

export const removeOldUsers = functions.pubsub.topic( "hourly-tick" ).onPublish( event => {
    const inactiveUsers = new InactiveUsers();
    
    return inactiveUsers.delete().then( ( deletedUsers ) => {
        console.log( `Deleted ${deletedUsers.length} inactive users` );
    } );
} );

Delete users collection from firestore too

export const removeOldUsers = functions.pubsub.topic( "hourly-tick" ).onPublish( event => {
    const inactiveUsers = new InactiveUsers();
    
    return inactiveUsers.delete( [ db.collection( "users" ), db.collection( "posts" ) ] ).then( ( deletedUsers ) => {
        console.log( `Deleted ${deletedUsers.length} inactive users` );
    } );
} );

Package Sidebar

Install

npm i @beyond-agentur-ug/firebase-delete-inactive-users

Weekly Downloads

1

Version

0.0.8

License

GNU GPLv3

Unpacked Size

42.3 kB

Total Files

10

Last publish

Collaborators

  • kersten