- Aggiornato node.js alla versione 22.18.1

- Aggiornato tutti i pacchetti del server all'ultima versione.
- passato mongoose da versione 5 a versione 6
This commit is contained in:
Surya Paolo
2025-03-03 00:46:08 +01:00
parent 45d06b0923
commit 53a70a1c96
120 changed files with 3385 additions and 6065 deletions

View File

@@ -108,7 +108,7 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
var Todo = this;
let tofind = {
category: ObjectId(category),
category: new ObjectId(category),
$or:
[{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
@@ -126,9 +126,6 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
};
// User.find({ admin: true }).where('created_at').gt(monthAgo).exec(function(err, users) {
// if (err) throw err;
function getQueryFilterTodo(userId) {
let myobj = [
// { userId: userId },
@@ -225,7 +222,7 @@ TodoSchema.statics.enabletoModify = async function (userId, idTodo) {
var Todo = this;
let params = {};
params['_id'] = ObjectId(idTodo);
params['_id'] = new ObjectId(idTodo);
const query = getQueryTodo(params, userId);
return Todo.aggregate(query)
@@ -519,9 +516,10 @@ TodoSchema.pre('save', function (next) {
var Todo = mongoose.model('Todos', TodoSchema);
Todo.createIndexes((err) => {
if (err) throw err;
});
Todo.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Todo };