Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default database.ref('/users_count').onDelete((data, context) => {
const getDBUsers = admin
.database()
.ref('users')
.once('value')
const getAuthUsers = usersUtil.listAllUsers()
return Promise.all([getDBUsers, getAuthUsers]).then(resulsts => {
const dbUsers = resulsts[0]
const authUsers = resulsts[1]
let promises = []
let userUids = []
let providerCount = {}
let usersPublicData = {}
let usersNotificationTokens = {}
authUsers.forEach(userRecord => {
const user = userRecord.toJSON()
let userPublicProviderData = {}
const creationTime = moment(user.metadata.creationTime)