v1.6.2/cleanup
- remove api v2 - linting
This commit is contained in:
@@ -17,29 +17,26 @@ module.exports = async (req, res) => {
|
||||
body: JSON.stringify({
|
||||
grant_type: 'client_credentials',
|
||||
}),
|
||||
}).then((oauthResponse) => oauthResponse.json())
|
||||
.catch((err) => res.status(500).send({err, message: 'Unable to generate token for call'}));
|
||||
})
|
||||
.then((oauthResponse) => oauthResponse.json())
|
||||
.catch((err) => res.status(500).send({ err, message: 'Unable to generate token for call' }));
|
||||
|
||||
const [exists, conferencePending, conference, adminOnly, adminUid] = await admin
|
||||
.firestore()
|
||||
.collection('rooms')
|
||||
.doc(req.params.partyName)
|
||||
.get()
|
||||
.then(snap => {
|
||||
const data = snap.exists ? snap.data() : {};
|
||||
return [snap.exists, data.conferencePending, data.conference, data.adminOnly, data.adminUid];
|
||||
});
|
||||
.firestore()
|
||||
.collection('rooms')
|
||||
.doc(req.params.partyName)
|
||||
.get()
|
||||
.then((snap) => {
|
||||
const data = snap.exists ? snap.data() : {};
|
||||
return [snap.exists, data.conferencePending, data.conference, data.adminOnly, data.adminUid];
|
||||
});
|
||||
|
||||
if (exists === true) {
|
||||
if (conference === undefined || conference === null) {
|
||||
if (conferencePending === undefined || conferencePending === null) {
|
||||
if (!adminOnly || (adminOnly && (adminUid === bodyData.uid)) ) {
|
||||
await admin
|
||||
.firestore()
|
||||
.collection('rooms')
|
||||
.doc(req.params.partyName)
|
||||
.update({
|
||||
conferencePending: bodyData.uid
|
||||
if (!adminOnly || (adminOnly && adminUid === bodyData.uid)) {
|
||||
await admin.firestore().collection('rooms').doc(req.params.partyName).update({
|
||||
conferencePending: bodyData.uid,
|
||||
});
|
||||
await admin
|
||||
.firestore()
|
||||
@@ -51,7 +48,7 @@ module.exports = async (req, res) => {
|
||||
name: '',
|
||||
text: 'A call session is being created (will be available soon).',
|
||||
time: new Date(),
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user