Reportistica Ore 3
This commit is contained in:
@@ -281,6 +281,8 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
if (mydata["_id"] === undefined) {
|
||||
mydata._id = 1;
|
||||
}
|
||||
} else if (params.table === 'hours') {
|
||||
|
||||
} else {
|
||||
if (mydata["_id"] === undefined) {
|
||||
mydata._id = new ObjectID()
|
||||
@@ -302,7 +304,11 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
if (e.code === 11000) {
|
||||
const id = mytablerec._id;
|
||||
delete mytablerec._doc['_id'];
|
||||
return mytablestrutt.findByIdAndUpdate(id, { $set: mytablerec._doc }).then(async (rec) => {
|
||||
const myfields = mytablerec._doc;
|
||||
if (!myfields.userId) {
|
||||
myfields.userId = req.user._id.toString();
|
||||
}
|
||||
return mytablestrutt.findByIdAndUpdate(id, { $set: myfields }).then(async (rec) => {
|
||||
return res.send(rec);
|
||||
}).catch((err) => {
|
||||
tools.mylog('error: ', err.message);
|
||||
|
||||
Reference in New Issue
Block a user