Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import * as admin from 'firebase-admin'
|
|
|
|
import { initAdmin } from 'shared/init-admin'
|
|
initAdmin()
|
|
|
|
import { PrivateUser } from 'common/user'
|
|
import { getDefaultNotificationPreferences } from 'common/user-notification-preferences'
|
|
import { isProd } from 'shared/utils'
|
|
|
|
const firestore = admin.firestore()
|
|
|
|
async function main() {
|
|
if (isProd())
|
|
return console.log('This script is not allowed to run in production')
|
|
const snap = await firestore.collection('private-users').get()
|
|
const users = snap.docs.map((d) => d.data() as PrivateUser)
|
|
|
|
await Promise.all(
|
|
users.map(async (user) => {
|
|
const privateUser: PrivateUser = {
|
|
id: user.id,
|
|
notificationPreferences: getDefaultNotificationPreferences(true),
|
|
blockedUserIds: [],
|
|
blockedByUserIds: [],
|
|
blockedContractIds: [],
|
|
blockedGroupSlugs: [],
|
|
}
|
|
try {
|
|
await firestore
|
|
.collection('private-users')
|
|
.doc(user.id)
|
|
.set(privateUser)
|
|
|
|
console.log('created private user for:', user.id)
|
|
} catch (e) {
|
|
console.log('error creating private user for:', user.id, e)
|
|
}
|
|
})
|
|
)
|
|
}
|
|
|
|
if (require.main === module) main().then(() => process.exit())
|