v1.7.6/show player updated by

This commit is contained in:
2020-09-16 14:17:55 -04:00
parent 646a120df7
commit b9e3b549b2
7 changed files with 17 additions and 15 deletions
+1 -13
View File
@@ -23,18 +23,6 @@ module.exports = async (req, res) => {
});
if (exists && roomPin !== bodydata.partyPin)
return res.status(401).send({ message: 'Incorrect party pin' });
if (adminUid === bodydata.uid) {
await admin
.firestore()
.collection('rooms')
.doc(bodydata.partyName)
.collection('users')
.doc(bodydata.uid)
.set({
admin: true,
name: bodydata.userName,
});
}
// GET IF USER EXISTS AND IS ADMIN
const [userExists, userAdmin, userName] = await admin
.firestore()
@@ -101,7 +89,7 @@ module.exports = async (req, res) => {
.collection('users')
.doc(bodydata.uid)
.set({
admin: false,
admin: adminUid === bodydata.uid,
name: bodydata.userName,
})
.catch((err) => {
+2
View File
@@ -2,6 +2,8 @@ const admin = require('firebase-admin');
module.exports = async (req, res) => {
console.log('Requested Leave - UID - ', req.params.uid, '\n\tRoom - ', req.params.rid);
if (req.params.uid === 'undefined') return res.status(400).send({ message: 'No UID' });
if (req.params.rid === 'undefined') return res.status(400).send({ message: 'No Party Name' });
const userName = await admin
.firestore()
.collection('rooms')
+1
View File
@@ -26,6 +26,7 @@ module.exports = async (req, res) => {
}
}
if (roomData.status !== player.status) {
player.updatedByName = userName;
await admin
.firestore()
.collection('rooms')