v1.7.6/show player updated by
This commit is contained in:
@@ -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,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')
|
||||
|
||||
@@ -26,6 +26,7 @@ module.exports = async (req, res) => {
|
||||
}
|
||||
}
|
||||
if (roomData.status !== player.status) {
|
||||
player.updatedByName = userName;
|
||||
await admin
|
||||
.firestore()
|
||||
.collection('rooms')
|
||||
|
||||
Reference in New Issue
Block a user