Files
freeplanet_serverside/src/server/models/cashCategory.js
Surya Paolo 6270991b76 - Conversione Codice... Errore Service Worker regostration.
- Sistemare quasar.config.ts di piuchebuono!
-Le categorie non si vedono piu !!
2025-03-06 01:23:56 +01:00

75 lines
1.6 KiB
JavaScript
Executable File

const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
const tools = require('../tools/general');
const { ObjectId } = require('mongodb');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const CashCategorySchema = new Schema({
idapp: {
type: String,
},
descr: {
type: String,
},
notes: {
type: String
},
});
var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema);
CashCategory.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports.getFieldsForSearch = function () {
return []
};
module.exports.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CashCategory.find(myfind).lean();
};
module.exports.getAllCashCategory = function (query, sort, callback) {
CashCategory.find(query, null, sort, callback)
}
module.exports.getCashCategoryByUserId = function (userId, sort, callback) {
CashCategory.find({ userId }, null, sort, callback)
}
module.exports.getCashCategoryByID = function (id, callback) {
CashCategory.findById(id, callback);
}
module.exports.createCashCategory = async function (CashCategory) {
const CashCategoryModel = new CashCategory(CashCategory);
return await CashCategoryModel.save(CashCategory)
.then((ris) => {
if (!!ris)
return ris._id;
return null;
});
}