Skip to content

Commit

Permalink
Add reason to payment (#265)
Browse files Browse the repository at this point in the history
* Add ability to add reason to payments

* Bump version and update packages
  • Loading branch information
ANDREYDEN authored Apr 27, 2024
1 parent 8ffbf79 commit ca02182
Show file tree
Hide file tree
Showing 11 changed files with 1,805 additions and 1,033 deletions.
23 changes: 6 additions & 17 deletions admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@ const db = admin.firestore();
const auth = admin.auth();

(async () => {
const users = await auth.listUsers()
console.log(`Found ${users.users.length} users.`);
for (const user of users.users) {
console.log(`Processing user doc for ${user.uid}...`);
try {
const userDocRef = await db.doc(`users/${user.uid}`).get()
if (!userDocRef.exists) {
console.log(`Creating user doc for ${user.uid}...`);
await db.doc(`users/${user.uid}`).set({
name: user.displayName ?? 'anonymous',
photoURL: user.photoURL ?? null,
})
}
} catch (error) {
console.log(`Could not create user doc for ${user.uid}: `, error);
}
const payments = await db.collection('payments').where('reason', '!=', null).get()
console.log(`Found ${payments.docs.length} payments`)
for (const payment of payments.docs) {
await payment.ref.update({
isAdmin: true
})
}

})();

function addUserToGroup(group, user) {
Expand Down
Loading

0 comments on commit ca02182

Please sign in to comment.