Backfill all users badges
This commit is contained in:
parent
333c797de0
commit
b0e543957c
|
@ -1,7 +1,7 @@
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
import { getUser, getValues } from '../utils'
|
import { getAllUsers, getValues } from '../utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from 'common/contract'
|
||||||
import {
|
import {
|
||||||
MarketCreatorBadge,
|
MarketCreatorBadge,
|
||||||
|
@ -10,18 +10,17 @@ import {
|
||||||
streakerBadgeRarityThresholds,
|
streakerBadgeRarityThresholds,
|
||||||
} from 'common/badge'
|
} from 'common/badge'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { filterDefined } from 'common/util/array'
|
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
// const users = await getAllUsers()
|
const users = await getAllUsers()
|
||||||
// const users = filterDefined([await getUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')])
|
// const users = filterDefined([await getUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')]) // dev ian
|
||||||
const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')])
|
// const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) // prod ian
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
users.map(async (user) => {
|
users.map(async (user) => {
|
||||||
console.log('Added achievements to user', user.id)
|
// console.log('Added achievements to user', user.id)
|
||||||
if (!user.id) return
|
if (!user.id) return
|
||||||
if (user.achievements === undefined) {
|
if (user.achievements === undefined) {
|
||||||
await firestore.collection('users').doc(user.id).update({
|
await firestore.collection('users').doc(user.id).update({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user