v1.2.1-beta/functions refactor

This commit is contained in:
Ayushya Amitabh
2020-05-26 14:04:04 -04:00
parent 0184c01504
commit ab13a67d08
15 changed files with 561 additions and 492 deletions
+19
View File
@@ -0,0 +1,19 @@
const admin = require('firebase-admin');
module.exports = async (req, res) => {
console.log('Requested Leave - UID - ', req.params.uid, '\n\tRoom - ', req.params.rid);
await admin
.firestore()
.collection('rooms')
.doc(req.params.rid)
.collection('users')
.doc(req.params.uid)
.delete()
.catch((err) =>
console.error(
`Failed to remove user from party : \n\t Room: ${req.params.rid} \n\t User: ${req.params.uid}`,
err
)
);
res.status(200).send({ message: 'Left the party' });
};