- Iscrizione Conacreis
This commit is contained in:
127
src/server/models/cash.js
Executable file
127
src/server/models/cash.js
Executable file
@@ -0,0 +1,127 @@
|
||||
const mongoose = require('mongoose');
|
||||
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 CashSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
creatorUserId: {
|
||||
type: String,
|
||||
},
|
||||
idCashCategory: {
|
||||
type: String
|
||||
},
|
||||
idSubCashCategory: {
|
||||
type: String
|
||||
},
|
||||
type: { // CashType: TYPE_IN, TYPE_OUT
|
||||
type: Number
|
||||
},
|
||||
date_created: {
|
||||
type: Date
|
||||
},
|
||||
date_payment: {
|
||||
type: Date
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
price: {
|
||||
type: Number
|
||||
},
|
||||
quantity: {
|
||||
type: Number
|
||||
},
|
||||
total: {
|
||||
type: Number
|
||||
},
|
||||
fromWalletUserId: { // walletCommonCash or any Member
|
||||
type: String,
|
||||
},
|
||||
toWalletUserId: { // walletCommonCash or any Member
|
||||
type: String,
|
||||
},
|
||||
walletStatus: { // WalletFinalStatusType: None: 0, InCommonCash: 1, InMyWallet : 2
|
||||
type: Number,
|
||||
},
|
||||
walletTemporaryToUserId: { // WalletCommonCash
|
||||
type: String,
|
||||
},
|
||||
walletCashId: {
|
||||
type: String,
|
||||
},
|
||||
internal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
extra: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
notes: {
|
||||
type: String
|
||||
},
|
||||
confirmed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
var Cash = module.exports = mongoose.model('Cash', CashSchema);
|
||||
|
||||
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 Cash.find(myfind);
|
||||
};
|
||||
|
||||
module.exports.getAllCash = function (query, sort, callback) {
|
||||
Cash.find(query, null, sort, callback)
|
||||
}
|
||||
|
||||
module.exports.getCashByUserId = function (userId, sort, callback) {
|
||||
Cash.find({ userId }, null, sort, callback)
|
||||
}
|
||||
|
||||
|
||||
module.exports.getCashByID = function (id, callback) {
|
||||
Cash.findById(id, callback);
|
||||
}
|
||||
|
||||
module.exports.createCash = async function (Cash) {
|
||||
const CashModel = new Cash(Cash);
|
||||
|
||||
return await CashModel.save(Cash)
|
||||
.then((ris) => {
|
||||
if (!!ris)
|
||||
return ris._id;
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// const Cash = mongoose.model('Cash', CashSchema);
|
||||
|
||||
// module.exports = { Cash };
|
||||
68
src/server/models/cashCategory.js
Executable file
68
src/server/models/cashCategory.js
Executable file
@@ -0,0 +1,68 @@
|
||||
const mongoose = require('mongoose');
|
||||
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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
71
src/server/models/cashSubCategory.js
Executable file
71
src/server/models/cashSubCategory.js
Executable file
@@ -0,0 +1,71 @@
|
||||
const mongoose = require('mongoose');
|
||||
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 CashSubCategorySchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
idCashCategory: {
|
||||
type: String,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
notes: {
|
||||
type: String
|
||||
},
|
||||
});
|
||||
|
||||
var CashSubCategory = module.exports = mongoose.model('CashSubCategory', CashSubCategorySchema);
|
||||
|
||||
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 CashSubCategory.find(myfind);
|
||||
};
|
||||
|
||||
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
||||
CashSubCategory.find(query, null, sort, callback)
|
||||
}
|
||||
|
||||
module.exports.getCashSubCategoryByUserId = function (userId, sort, callback) {
|
||||
CashSubCategory.find({ userId }, null, sort, callback)
|
||||
}
|
||||
|
||||
|
||||
module.exports.getCashSubCategoryByID = function (id, callback) {
|
||||
CashSubCategory.findById(id, callback);
|
||||
}
|
||||
|
||||
module.exports.createCashSubCategory = async function (CashSubCategory) {
|
||||
const CashSubCategoryModel = new CashSubCategory(CashSubCategory);
|
||||
|
||||
return await CashSubCategoryModel.save(CashSubCategory)
|
||||
.then((ris) => {
|
||||
if (!!ris)
|
||||
return ris._id;
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -57,24 +57,39 @@ const IscrittiConacreisSchema = new Schema({
|
||||
dateofbirth: {
|
||||
type: Date,
|
||||
},
|
||||
born_city: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
born_province: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
born_country: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
cell_phone: {
|
||||
type: String,
|
||||
},
|
||||
newsletter_on: {
|
||||
type: Boolean,
|
||||
},
|
||||
accetta_carta_costituzionale_on: {
|
||||
type: Boolean,
|
||||
},
|
||||
terms: {
|
||||
type: Boolean,
|
||||
},
|
||||
metodo_pagamento: {
|
||||
type: Number,
|
||||
},
|
||||
iscrizione_compilata: {
|
||||
type: Boolean,
|
||||
},
|
||||
dateofreg: {
|
||||
type: Date,
|
||||
},
|
||||
dateofapproved: {
|
||||
type: Date,
|
||||
},
|
||||
codiceConacreis: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -112,6 +112,9 @@ const MyEventSchema = new Schema({
|
||||
internal: {
|
||||
type: Boolean,
|
||||
},
|
||||
note: {
|
||||
type: String,
|
||||
},
|
||||
deleted: {
|
||||
type: Boolean,
|
||||
},
|
||||
|
||||
@@ -270,6 +270,9 @@ const UserSchema = new mongoose.Schema({
|
||||
come_ci_hai_conosciuto: {
|
||||
type: Boolean,
|
||||
},
|
||||
socio: {
|
||||
type: Boolean,
|
||||
},
|
||||
socioresidente: {
|
||||
type: Boolean,
|
||||
},
|
||||
@@ -1445,7 +1448,7 @@ UserSchema.statics.isAdminByIdTeleg = async function (idapp, idtelegram) {
|
||||
|
||||
return await User.findOne({
|
||||
idapp,
|
||||
username: 'paoloar77',
|
||||
username: 'paoloarcnm',
|
||||
'profile.manage_telegram': true,
|
||||
'profile.teleg_id': idtelegram
|
||||
}, { 'profile.teleg_id': 1 })
|
||||
|
||||
Reference in New Issue
Block a user