mirror of
https://github.com/janoodleFTW/timy-messenger.git
synced 2026-01-23 02:14:39 +00:00
25 lines
501 B
JavaScript
25 lines
501 B
JavaScript
const { db } = require('./admin');
|
|
|
|
const getAllGroups = async () => {
|
|
let groupDocs = await db
|
|
.collection('groups')
|
|
.get();
|
|
|
|
if (groupDocs.empty) {
|
|
console.log('Could not find any groups');
|
|
return null;
|
|
}
|
|
|
|
return groupDocs;
|
|
}
|
|
|
|
const getGroupName = async (groupId) => {
|
|
let groupDoc = await db
|
|
.collection('groups')
|
|
.doc(groupId)
|
|
.get();
|
|
|
|
return groupDoc.data().name;
|
|
}
|
|
|
|
module.exports = { getGroupName, getAllGroups };
|