Limited arr length to 1

This commit is contained in:
nannal 2020-10-07 18:57:40 +03:00
parent e12739b781
commit cb6e84dab2
3 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,6 @@
const express = require('express')
const bodyParser = require('body-parser');
const list = require("./listManager.js");
const { response } = require('express');
const app = express()
app.use(bodyParser.json(),function (req, res, next) {

View File

@ -48,13 +48,20 @@ list = {
return await mongo.get("list","list",{"status": status})
},
getUser: async (username) => {
return await mongo.get("list","list",{"user": username})
res = await mongo.get("list","list",{"user": username})
return res[0]
},
writeUser: async (obj) => {
ver = await verifyMsg(obj)
if (ver == true) {
console.log(obj)
res = await mongo.get("list","list",{"user": obj.user})
if (res.length > 0 ){
mongo.update("list","list",{"user": obj.user}, obj)
} else {
mongo.put("list","list", obj)
}
mongo.update("list","list",{"user": obj.user}, obj)
return {"Message":"Success"}
} else {
return ver

View File

@ -1,3 +1,3 @@
users = ["nannal", "hightouch"]
users = ["nannal", "hightouch", "heimindanger"]
module.exports = users