-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-user-data.js
More file actions
44 lines (38 loc) · 1.45 KB
/
check-user-data.js
File metadata and controls
44 lines (38 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { initializeApp } from 'firebase/app';
import { getFirestore, collection, getDocs } from 'firebase/firestore';
const firebaseConfig = {
apiKey: "AIzaSyDAnazLfiG1gh6LU1X4RP2LPnhJTPI-W_I",
authDomain: "issue-hive-64473.firebaseapp.com",
projectId: "issue-hive-64473",
storageBucket: "issue-hive-64473.firebasestorage.app",
messagingSenderId: "632176633299",
appId: "1:632176633299:web:48e22f30872eeddd59eff4",
measurementId: "G-W0ZVTXR82P"
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
async function checkUsers() {
try {
const usersSnapshot = await getDocs(collection(db, 'users'));
console.log('\n=== Current Users in Firestore ===\n');
if (usersSnapshot.empty) {
console.log('No users found in Firestore');
} else {
usersSnapshot.forEach(doc => {
const data = doc.data();
console.log(`User ID: ${doc.id}`);
console.log(` Display Name: ${data.displayName || 'N/A'}`);
console.log(` Email: ${data.email || 'N/A'}`);
console.log(` Username: ${data.username || 'N/A'}`);
console.log(` Created At: ${data.createdAt ? new Date(data.createdAt).toISOString() : 'MISSING ❌'}`);
console.log(` Updated At: ${data.updatedAt ? new Date(data.updatedAt).toISOString() : 'N/A'}`);
console.log('---');
});
}
process.exit(0);
} catch (error) {
console.error('Error:', error);
process.exit(1);
}
}
checkUsers();