better levelid system

This commit is contained in:
oatmealine 2020-01-25 16:37:55 +03:00
parent f83da9c36f
commit e39a550b9a
No known key found for this signature in database
GPG Key ID: C4CB49CFAD721145
1 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,12 @@
module.exports = (app, db): void => {
app.post('/aa/database/uploadGJLevel21.php', async (req, res) => {
let levelID = await db.collection('levels').find({}).count() + 1;
let levels = await db.collection('levels')
.find({})
.toArray();
levels.sort((a, b) => b.id - a.id);
let levelID = levels[0].id + 1;
console.log(req.body);