We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn this function, that generates SQL into a cloud function
async function run() { try { const batchSize = 1000; // Define the batch size for each page let nextPageToken = undefined; // Token to fetch the next page of users const queryPromises = []; while (true) { const result = await admin.auth().listUsers(batchSize, nextPageToken); const users = result.users; const batchPromises = users.map(async (user) => { const queteurDoc = await db.collection("queteurs").doc(user.uid).get(); const queteurData = queteurDoc.data(); if (queteurData) { const providerId = user.providerData.length > 0 ? user.providerData[0].providerId : null; const queteur_id = queteurData['queteur_id']; const ul_id = queteurData['ul_id']; const email = queteurData['email']; const first_name = queteurData['first_name']; const last_name = queteurData['last_name']; return `UPDATE queteur q SET q.firebase_uid='${user.uid}', q.firebase_sign_in_provider='${providerId}' WHERE q.id = ${queteur_id} AND q.ul_id = ${ul_id}; -- ${first_name} ${last_name}`; } return null; }); queryPromises.push(...batchPromises); nextPageToken = result.pageToken; // Set the token for the next page if (!nextPageToken) { break; // Exit the loop if there are no more pages } } const results = await Promise.all(queryPromises); results.forEach((query) => { if (query !== null) { console.log(query); } }); } catch (error) { console.log("Error retrieving data:", error); } } run().catch((error) => { console.log("Error:", error); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Turn this function, that generates SQL into a cloud function
The text was updated successfully, but these errors were encountered: