Campo Citta di Nascita (nel profilo nuova maniera), manca ancora da sistemare l'edit
Se seleziono la Provincia , mi deve comparire la lista dei comuni
This commit is contained in:
24
README.md
24
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Freeplanet_serverside
|
# Freeplanet_serverside
|
||||||
|
|
||||||
A Node JS
|
- Node JS (ver. 16.14.0 or up)
|
||||||
|
|
||||||
## Install the dependencies
|
## Install the dependencies
|
||||||
```bash
|
```bash
|
||||||
@@ -12,11 +12,31 @@ yarn
|
|||||||
node src/server/server.js
|
node src/server/server.js
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build the test ambient
|
### Creating the ambient test
|
||||||
|
|
||||||
|
Create your .env.test file copying from .env.development
|
||||||
|
```bash
|
||||||
|
cp .env.development .env.test
|
||||||
|
```
|
||||||
|
|
||||||
|
And modifying the file with your configuration
|
||||||
|
|
||||||
|
|
||||||
|
### Build the ambient test
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./deploynodejs_on_test.js
|
./deploynodejs_on_test.js
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Creating the ambient Production
|
||||||
|
|
||||||
|
Create your .env.production file copying from .env.development
|
||||||
|
```bash
|
||||||
|
cp .env.development .env.production
|
||||||
|
```
|
||||||
|
|
||||||
|
And modifying the file with your configuration
|
||||||
|
|
||||||
### Build the production
|
### Build the production
|
||||||
```bash
|
```bash
|
||||||
./deploynodejs_on_production.js
|
./deploynodejs_on_production.js
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module.exports = {
|
|||||||
name: "FreePlanetServerSide",
|
name: "FreePlanetServerSide",
|
||||||
script: "./src/server/server.js",
|
script: "./src/server/server.js",
|
||||||
ignore_watch : ["node_modules"],
|
ignore_watch : ["node_modules"],
|
||||||
watch: true,
|
watch: false,
|
||||||
env: {
|
env: {
|
||||||
"PORT": 3000,
|
"PORT": 3000,
|
||||||
"NODE_ENV": "development"
|
"NODE_ENV": "development"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"test-watch": "nodemon --exec 'npm test'"
|
"test-watch": "nodemon --exec 'npm test'"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.4.0"
|
"node": "^16.14.0"
|
||||||
},
|
},
|
||||||
"author": "Paolo Arena",
|
"author": "Paolo Arena",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
67
src/server/models/adtypegood.js
Executable file
67
src/server/models/adtypegood.js
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
const mongoose = require('mongoose').set('debug', false);
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
mongoose.Promise = global.Promise;
|
||||||
|
mongoose.level = "";
|
||||||
|
|
||||||
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
const {ObjectID} = require('mongodb');
|
||||||
|
|
||||||
|
// Resolving error Unknown modifier: $pushAll
|
||||||
|
mongoose.plugin(schema => {
|
||||||
|
schema.options.usePushEach = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const AdTypeGoodSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
descr: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
AdTypeGoodSchema.pre('save', async function (next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await AdTypeGood.findOne().limit(1).sort({_id:-1});
|
||||||
|
if (!!myrec) {
|
||||||
|
if (myrec._doc._id === 0)
|
||||||
|
this._id = 1;
|
||||||
|
else
|
||||||
|
this._id = myrec._doc._id + 1;
|
||||||
|
} else {
|
||||||
|
this._id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
AdTypeGoodSchema.statics.findAllIdApp = async function(idapp) {
|
||||||
|
const AdTypeGood = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{$sort: {_id: 1}},
|
||||||
|
];
|
||||||
|
|
||||||
|
return AdTypeGood.aggregate(query).then((arrrec) => {
|
||||||
|
return arrrec;
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
AdTypeGoodSchema.statics.getFieldsForSearch = function() {
|
||||||
|
return [
|
||||||
|
{field: 'descr', type: tools.FieldType.string}];
|
||||||
|
};
|
||||||
|
|
||||||
|
AdTypeGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
return tools.executeQueryTable(this, 0, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema);
|
||||||
|
|
||||||
|
module.exports = {AdTypeGood};
|
||||||
@@ -109,16 +109,29 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
|
|||||||
|
|
||||||
const strfind = params.search;
|
const strfind = params.search;
|
||||||
|
|
||||||
if (strfind === '') {
|
if (strfind === '' && !params.filter) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let filterfindexact = {comune: strfind};
|
let filterfindexact = {};
|
||||||
const risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
if (strfind){
|
||||||
|
filterfindexact = {comune: strfind};
|
||||||
|
}
|
||||||
|
|
||||||
|
let limit = 10
|
||||||
|
let risexact = []
|
||||||
|
|
||||||
|
|
||||||
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}};
|
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}};
|
||||||
|
|
||||||
let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(10);
|
if (params.filter) {
|
||||||
|
filterfind = {...params.filter, ...filterfind}
|
||||||
|
limit = 200
|
||||||
|
} else{
|
||||||
|
risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||||
|
}
|
||||||
|
|
||||||
|
let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(limit);
|
||||||
|
|
||||||
return [...risexact, ...ris];
|
return [...risexact, ...ris];
|
||||||
|
|
||||||
|
|||||||
83
src/server/models/good.js
Executable file
83
src/server/models/good.js
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
const mongoose = require('mongoose').set('debug', false)
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
mongoose.Promise = global.Promise;
|
||||||
|
mongoose.level = "F";
|
||||||
|
|
||||||
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
const { ObjectID } = require('mongodb');
|
||||||
|
|
||||||
|
// Resolving error Unknown modifier: $pushAll
|
||||||
|
mongoose.plugin(schema => {
|
||||||
|
schema.options.usePushEach = true
|
||||||
|
});
|
||||||
|
|
||||||
|
const GoodSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
descr: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
idSectorGood: [{
|
||||||
|
type: Number
|
||||||
|
}],
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
img: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
GoodSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
|
const Good = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{ $sort: { descr: 1 } }
|
||||||
|
];
|
||||||
|
|
||||||
|
const res = Good
|
||||||
|
.aggregate(query)
|
||||||
|
.then((arrrec) => {
|
||||||
|
return arrrec
|
||||||
|
})
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GoodSchema.pre('save', async function (next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await Good.findOne().limit(1).sort({_id:-1});
|
||||||
|
if (!!myrec) {
|
||||||
|
if (myrec._doc._id === 0)
|
||||||
|
this._id = 1;
|
||||||
|
else
|
||||||
|
this._id = myrec._doc._id + 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this._id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GoodSchema.statics.getFieldsForSearch = function () {
|
||||||
|
return [{ field: 'label', type: tools.FieldType.string },
|
||||||
|
{ field: 'descr', type: tools.FieldType.string }]
|
||||||
|
};
|
||||||
|
|
||||||
|
GoodSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
return tools.executeQueryTable(this, 0, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const Good = mongoose.model('Good', GoodSchema);
|
||||||
|
|
||||||
|
module.exports = { Good };
|
||||||
@@ -29,11 +29,6 @@ const MyBachecaSchema = new Schema({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
idSubSkill: [
|
|
||||||
{
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
}],
|
|
||||||
idStatusSkill: [
|
idStatusSkill: [
|
||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -361,14 +356,14 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
'from': 'subskills',
|
'from': 'subskills',
|
||||||
'localField': 'idSubSkill',
|
'localField': 'idSubSkill',
|
||||||
'foreignField': '_id',
|
'foreignField': '_id',
|
||||||
'as': 'MyBacheca',
|
'as': 'MyBacheca',
|
||||||
},
|
},
|
||||||
},
|
},*/
|
||||||
{
|
{
|
||||||
'$replaceRoot': {
|
'$replaceRoot': {
|
||||||
'newRoot': {
|
'newRoot': {
|
||||||
@@ -390,7 +385,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
@@ -442,7 +437,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
|||||||
481
src/server/models/mygood.js
Executable file
481
src/server/models/mygood.js
Executable file
@@ -0,0 +1,481 @@
|
|||||||
|
const mongoose = require('mongoose').set('debug', false);
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
mongoose.Promise = global.Promise;
|
||||||
|
mongoose.level = 'F';
|
||||||
|
|
||||||
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
const {ObjectID} = require('mongodb');
|
||||||
|
|
||||||
|
// Resolving error Unknown modifier: $pushAll
|
||||||
|
mongoose.plugin(schema => {
|
||||||
|
schema.options.usePushEach = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const MyGoodSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
idapp: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
||||||
|
idSectorGood: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
idGood: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
idShipping: [
|
||||||
|
{
|
||||||
|
type: Number,
|
||||||
|
}],
|
||||||
|
|
||||||
|
idContribType: [
|
||||||
|
{
|
||||||
|
type: String,
|
||||||
|
}],
|
||||||
|
idCity: [
|
||||||
|
{
|
||||||
|
type: Number,
|
||||||
|
}],
|
||||||
|
numLevel: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
adType: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
photos: [
|
||||||
|
{
|
||||||
|
imagefile: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
alt: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
note: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
descr: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
website: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
date_created: {
|
||||||
|
type: Date,
|
||||||
|
default: Date.now,
|
||||||
|
},
|
||||||
|
date_updated: {
|
||||||
|
type: Date,
|
||||||
|
default: Date.now,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
MyGoodSchema.pre('save', async function(next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await MyGood.findOne().limit(1).sort({_id: -1});
|
||||||
|
if (!!myrec) {
|
||||||
|
if (myrec._doc._id === 0)
|
||||||
|
this._id = 1;
|
||||||
|
else
|
||||||
|
this._id = myrec._doc._id + 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this._id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.date_created = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
MyGoodSchema.statics.findAllIdApp = async function(idapp) {
|
||||||
|
const MyGood = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{$match: {idapp}},
|
||||||
|
{$sort: {descr: 1}},
|
||||||
|
];
|
||||||
|
|
||||||
|
return MyGood.aggregate(query).then((arrrec) => {
|
||||||
|
return arrrec;
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
MyGoodSchema.statics.getFieldsForSearch = function() {
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
MyGoodSchema.statics.getFieldsLastForSearch = function() {
|
||||||
|
return [
|
||||||
|
{field: 'note', type: tools.FieldType.string},
|
||||||
|
{field: 'descr', type: tools.FieldType.string},
|
||||||
|
{field: 'recGood.descr', type: tools.FieldType.string},
|
||||||
|
{field: 'MyGood.descr', type: tools.FieldType.string},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
|
const otherparams = {
|
||||||
|
lookup1: {
|
||||||
|
lk_tab: 'users',
|
||||||
|
lk_LF: 'userId',
|
||||||
|
lk_FF: '_id',
|
||||||
|
lk_as: 'user',
|
||||||
|
af_objId_tab: 'myId',
|
||||||
|
lk_proj: {
|
||||||
|
idGood: 1,
|
||||||
|
idShipping: 1,
|
||||||
|
MyGood: 1,
|
||||||
|
idStatusGood: 1,
|
||||||
|
idContribType: 1,
|
||||||
|
idCity: 1,
|
||||||
|
numLevel: 1,
|
||||||
|
adType: 1,
|
||||||
|
photos: 1,
|
||||||
|
note: 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
descr: 1,
|
||||||
|
date_created: 1,
|
||||||
|
date_updated: 1,
|
||||||
|
userId: 1,
|
||||||
|
username: 1,
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
params = {...params, ...otherparams};
|
||||||
|
|
||||||
|
return tools.executeQueryTable(this, idapp, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||||
|
const MyGood = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{
|
||||||
|
'$match': {
|
||||||
|
'$and': [
|
||||||
|
{
|
||||||
|
'_id': parseInt(idGood),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$match': {
|
||||||
|
'idapp': idapp,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$sort': {
|
||||||
|
'desc': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$addFields': {
|
||||||
|
'myId1': {
|
||||||
|
'$toObjectId': '$userId',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$lookup': {
|
||||||
|
'from': 'users',
|
||||||
|
'localField': 'myId1',
|
||||||
|
'foreignField': '_id',
|
||||||
|
'as': 'user',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$user',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$project': {
|
||||||
|
'recGood': 1,
|
||||||
|
'sectorgood': 1,
|
||||||
|
'idSectorGood': 1,
|
||||||
|
'idGood': 1,
|
||||||
|
'idShipping': 1,
|
||||||
|
'idStatusGood': 1,
|
||||||
|
'idContribType': 1,
|
||||||
|
'idCity': 1,
|
||||||
|
'numLevel': 1,
|
||||||
|
adType: 1,
|
||||||
|
'photos': 1,
|
||||||
|
note: 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
'descr': 1,
|
||||||
|
'date_created': 1,
|
||||||
|
'date_updated': 1,
|
||||||
|
'userId': 1,
|
||||||
|
'username': 1,
|
||||||
|
'name': 1,
|
||||||
|
'surname': 1,
|
||||||
|
'comune': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$lookup': {
|
||||||
|
'from': 'goods',
|
||||||
|
'localField': 'idGood',
|
||||||
|
'foreignField': '_id',
|
||||||
|
'as': 'recGood',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$recGood',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$project': {
|
||||||
|
'recGood': 1,
|
||||||
|
'sectorgood': 1,
|
||||||
|
'idSectorGood': 1,
|
||||||
|
'idGood': 1,
|
||||||
|
'idShipping': 1,
|
||||||
|
'idStatusGood': 1,
|
||||||
|
'idContribType': 1,
|
||||||
|
'idCity': 1,
|
||||||
|
'numLevel': 1,
|
||||||
|
adType: 1,
|
||||||
|
'photos': 1,
|
||||||
|
'note': 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
'descr': 1,
|
||||||
|
'date_created': 1,
|
||||||
|
'date_updated': 1,
|
||||||
|
'userId': 1,
|
||||||
|
'username': 1,
|
||||||
|
'name': 1,
|
||||||
|
'surname': 1,
|
||||||
|
'comune': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$lookup': {
|
||||||
|
'from': 'sectorgoods',
|
||||||
|
'localField': 'recGood.idSectorGood',
|
||||||
|
'foreignField': '_id',
|
||||||
|
'as': 'sectorgood',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$sectorgood',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$project': {
|
||||||
|
'recGood': 1,
|
||||||
|
'sectorgood': 1,
|
||||||
|
'idSectorGood': 1,
|
||||||
|
'idGood': 1,
|
||||||
|
'idShipping': 1,
|
||||||
|
'idStatusGood': 1,
|
||||||
|
'idContribType': 1,
|
||||||
|
'idCity': 1,
|
||||||
|
'numLevel': 1,
|
||||||
|
adType: 1,
|
||||||
|
'photos': 1,
|
||||||
|
'note': 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
'descr': 1,
|
||||||
|
'date_created': 1,
|
||||||
|
'date_updated': 1,
|
||||||
|
'userId': 1,
|
||||||
|
'username': 1,
|
||||||
|
'name': 1,
|
||||||
|
'surname': 1,
|
||||||
|
'comune': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$lookup': {
|
||||||
|
'from': 'subgoods',
|
||||||
|
'localField': 'idShipping',
|
||||||
|
'foreignField': '_id',
|
||||||
|
'as': 'MyGood',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$MyGood',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$project': {
|
||||||
|
'recGood': 1,
|
||||||
|
'sectorgood': 1,
|
||||||
|
'idSectorGood': 1,
|
||||||
|
'idGood': 1,
|
||||||
|
'idShipping': 1,
|
||||||
|
'idStatusGood': 1,
|
||||||
|
'idContribType': 1,
|
||||||
|
'idCity': 1,
|
||||||
|
'numLevel': 1,
|
||||||
|
adType: 1,
|
||||||
|
'photos': 1,
|
||||||
|
'note': 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
'descr': 1,
|
||||||
|
'date_created': 1,
|
||||||
|
'date_updated': 1,
|
||||||
|
'userId': 1,
|
||||||
|
'username': 1,
|
||||||
|
'name': 1,
|
||||||
|
'surname': 1,
|
||||||
|
'comune': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$lookup': {
|
||||||
|
'from': 'cities',
|
||||||
|
'localField': 'idCity',
|
||||||
|
'foreignField': '_id',
|
||||||
|
'as': 'mycities',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$mycities',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$project': {
|
||||||
|
'recGood': 1,
|
||||||
|
'sectorgood': 1,
|
||||||
|
'idSectorGood': 1,
|
||||||
|
'idGood': 1,
|
||||||
|
'idShipping': 1,
|
||||||
|
'idStatusGood': 1,
|
||||||
|
'idContribType': 1,
|
||||||
|
'idCity': 1,
|
||||||
|
'numLevel': 1,
|
||||||
|
adType: 1,
|
||||||
|
'photos': 1,
|
||||||
|
'note': 1,
|
||||||
|
website: 1,
|
||||||
|
//**ADDFIELD_MyGood
|
||||||
|
'descr': 1,
|
||||||
|
'date_created': 1,
|
||||||
|
'date_updated': 1,
|
||||||
|
'userId': 1,
|
||||||
|
'username': 1,
|
||||||
|
'name': 1,
|
||||||
|
'surname': 1,
|
||||||
|
'comune': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return MyGood.aggregate(query).then((rec) => {
|
||||||
|
return rec ? rec[0] : null;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
MyGoodSchema.statics.getCompleteRecord = function(idapp, id) {
|
||||||
|
const MyGood = this;
|
||||||
|
|
||||||
|
return MyGood.getMyGoodById(idapp, id);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const MyGood = mongoose.model('MyGood', MyGoodSchema);
|
||||||
|
|
||||||
|
module.exports = {MyGood};
|
||||||
@@ -106,9 +106,10 @@ MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
|
||||||
if (params.options) {
|
if (params.options) {
|
||||||
if (tools.isBitActive(params.options,
|
if (tools.isBitActive(params.options, shared_consts.OPTIONS_SEARCH_USER_ONLY_FULL_WORDS)) {
|
||||||
shared_consts.OPTIONS_SEARCH_USER_ONLY_FULL_WORDS)) {
|
|
||||||
params.fieldsearch = User.getFieldsForSearchUserFriend();
|
params.fieldsearch = User.getFieldsForSearchUserFriend();
|
||||||
|
} else if (tools.isBitActive(params.options, shared_consts.OPTIONS_SEARCH_USER_ALL_WORDS)) {
|
||||||
|
params.fieldsearch = User.getFieldsForSearchUserFriend_AllWords();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ const MySkillSchema = new Schema({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
idSubSkill: [
|
/*idSubSkill: [
|
||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
*/
|
||||||
idStatusSkill: [
|
idStatusSkill: [
|
||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -146,7 +148,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
af_objId_tab: 'myId',
|
af_objId_tab: 'myId',
|
||||||
lk_proj: {
|
lk_proj: {
|
||||||
idSkill: 1,
|
idSkill: 1,
|
||||||
idSubSkill: 1,
|
// idSubSkill: 1,
|
||||||
myskill: 1,
|
myskill: 1,
|
||||||
idStatusSkill: 1,
|
idStatusSkill: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
@@ -234,7 +236,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
@@ -286,7 +288,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
@@ -338,7 +340,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
//'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
@@ -361,7 +363,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
'from': 'subskills',
|
'from': 'subskills',
|
||||||
'localField': 'idSubSkill',
|
'localField': 'idSubSkill',
|
||||||
@@ -369,6 +371,8 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'as': 'myskill',
|
'as': 'myskill',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
'$replaceRoot': {
|
'$replaceRoot': {
|
||||||
'newRoot': {
|
'newRoot': {
|
||||||
@@ -390,7 +394,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
@@ -442,7 +446,7 @@ MySkillSchema.statics.getMySkillByIdkill = function(idapp, idSkill) {
|
|||||||
'sector': 1,
|
'sector': 1,
|
||||||
'idSector': 1,
|
'idSector': 1,
|
||||||
'idSkill': 1,
|
'idSkill': 1,
|
||||||
'idSubSkill': 1,
|
// 'idSubSkill': 1,
|
||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
|||||||
83
src/server/models/sectorgood.js
Executable file
83
src/server/models/sectorgood.js
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
const mongoose = require('mongoose').set('debug', false)
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
mongoose.Promise = global.Promise;
|
||||||
|
mongoose.level = "F";
|
||||||
|
|
||||||
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
const { ObjectID } = require('mongodb');
|
||||||
|
|
||||||
|
// Resolving error Unknown modifier: $pushAll
|
||||||
|
mongoose.plugin(schema => {
|
||||||
|
schema.options.usePushEach = true
|
||||||
|
});
|
||||||
|
|
||||||
|
const SectorGoodSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
descr: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
idSectorGood: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
img: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
SectorGoodSchema.pre('save', async function (next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await SectorGood.findOne().limit(1).sort({_id:-1});
|
||||||
|
if (!!myrec) {
|
||||||
|
if (myrec._doc._id === 0)
|
||||||
|
this._id = 1;
|
||||||
|
else
|
||||||
|
this._id = myrec._doc._id + 1;
|
||||||
|
} else {
|
||||||
|
this._id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
SectorGoodSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
|
const SectorGood = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{ $sort: { descr: 1 } }
|
||||||
|
];
|
||||||
|
|
||||||
|
return SectorGood
|
||||||
|
.aggregate(query)
|
||||||
|
.then((arrrec) => {
|
||||||
|
return arrrec
|
||||||
|
})
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
SectorGoodSchema.statics.getFieldsForSearch = function () {
|
||||||
|
return [{ field: 'descr', type: tools.FieldType.string }]
|
||||||
|
};
|
||||||
|
|
||||||
|
SectorGoodSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
return tools.executeQueryTable(this, 0, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const SectorGood = mongoose.model('SectorGood', SectorGoodSchema);
|
||||||
|
|
||||||
|
module.exports = { SectorGood };
|
||||||
@@ -21,6 +21,9 @@ const StatusSkillSchema = new Schema({
|
|||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -260,6 +260,9 @@ const UserSchema = new mongoose.Schema({
|
|||||||
type: String,
|
type: String,
|
||||||
trim: true,
|
trim: true,
|
||||||
},
|
},
|
||||||
|
born_city_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
born_province: {
|
born_province: {
|
||||||
type: String,
|
type: String,
|
||||||
trim: true,
|
trim: true,
|
||||||
@@ -1217,7 +1220,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
|||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
'profile.sex': 1,
|
'profile.sex': 1,
|
||||||
'profile.dateofbirth': 1,
|
'profile.dateofbirth': 1,
|
||||||
'profile.born_city': 1,
|
'profile.born_city_id': 1,
|
||||||
'profile.born_province': 1,
|
'profile.born_province': 1,
|
||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
@@ -1245,23 +1248,72 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
|||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
'profile.sex': 1,
|
'profile.sex': 1,
|
||||||
'profile.dateofbirth': 1,
|
'profile.dateofbirth': 1,
|
||||||
'profile.born_city': 1,
|
'profile.born_city_id': 1,
|
||||||
'profile.born_province': 1,
|
'profile.born_province': 1,
|
||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
|
'mycities': 1,
|
||||||
|
'comune': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return User.findOne({
|
const myfind = {
|
||||||
idapp, username,
|
idapp, username,
|
||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
};
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{$match: myfind},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: 'cities',
|
||||||
|
localField: 'profile.born_city_id',
|
||||||
|
foreignField: '_id',
|
||||||
|
as: 'mycities',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'$replaceRoot': {
|
||||||
|
'newRoot': {
|
||||||
|
'$mergeObjects': [
|
||||||
|
{
|
||||||
|
'$arrayElemAt': [
|
||||||
|
'$mycities',
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'$$ROOT',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{$project: whatToShow},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const ris = await User.aggregate(query);
|
||||||
|
|
||||||
|
if (ris && ris.length > 0)
|
||||||
|
return ris[0];
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
return User.findOne({
|
||||||
}, whatToShow).then((rec) => {
|
}, whatToShow).then((rec) => {
|
||||||
return (rec._doc);
|
return (rec._doc);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.getArrUsernameFromFieldByUsername = async function(
|
UserSchema.statics.getArrUsernameFromFieldByUsername = async function(
|
||||||
@@ -1417,7 +1469,8 @@ UserSchema.statics.setFriendsCmd = async function(
|
|||||||
}
|
}
|
||||||
if (ris) {
|
if (ris) {
|
||||||
// Invia una notifica alla persona
|
// Invia una notifica alla persona
|
||||||
tools.sendNotificationByUsername(idapp, usernameDest, cmd, true, usernameOrig);
|
tools.sendNotificationByUsername(idapp, usernameDest, cmd, true,
|
||||||
|
usernameOrig);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (foundIfAlreadyAskFriend) {
|
if (foundIfAlreadyAskFriend) {
|
||||||
@@ -1587,7 +1640,7 @@ function getWhatToShow(idapp, username) {
|
|||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
'profile.sex': 1,
|
'profile.sex': 1,
|
||||||
'profile.dateofbirth': 1,
|
'profile.dateofbirth': 1,
|
||||||
'profile.born_city': 1,
|
'profile.born_city_id': 1,
|
||||||
'profile.born_province': 1,
|
'profile.born_province': 1,
|
||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
@@ -2218,12 +2271,19 @@ UserSchema.statics.getFieldsForSearchUserFriend = function() {
|
|||||||
return [{field: 'username', type: tools.FieldType.exact}];
|
return [{field: 'username', type: tools.FieldType.exact}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getFieldsForSearchUserFriend_AllWords = function() {
|
||||||
|
return [{field: 'username', type: tools.FieldType.string}];
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.executeQueryTable = function(idapp, params) {
|
UserSchema.statics.executeQueryTable = function(idapp, params) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
if (params.options) {
|
if (params.options) {
|
||||||
if (tools.isBitActive(params.options,
|
if (tools.isBitActive(params.options,
|
||||||
shared_consts.OPTIONS_SEARCH_ONLY_FULL_WORDS)) {
|
shared_consts.OPTIONS_SEARCH_USER_ONLY_FULL_WORDS)) {
|
||||||
params.fieldsearch = this.getFieldsForSearchUserFriend();
|
params.fieldsearch = this.getFieldsForSearchUserFriend();
|
||||||
|
} else if (tools.isBitActive(params.options,
|
||||||
|
shared_consts.OPTIONS_SEARCH_USER_ALL_WORDS)) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearchUserFriend_AllWords();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params);
|
||||||
@@ -2557,25 +2617,31 @@ UserSchema.statics.checkUser = async function(idapp, username) {
|
|||||||
UserSchema.statics.calculateStat = async function(idapp, username) {
|
UserSchema.statics.calculateStat = async function(idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
const {MySkill} = require('../models/myskill');
|
try {
|
||||||
const {MyBacheca} = require('../models/mybacheca');
|
const {MySkill} = require('../models/myskill');
|
||||||
const {MyGroup} = require('../models/mygroup');
|
const {MyGood} = require('../models/mygood');
|
||||||
|
const {MyBacheca} = require('../models/mybacheca');
|
||||||
|
const {MyGroup} = require('../models/mygroup');
|
||||||
|
|
||||||
const numUsersReg = await User.countDocuments(
|
const numUsersReg = await User.countDocuments(
|
||||||
{
|
{
|
||||||
idapp,
|
idapp,
|
||||||
$or: [
|
$or: [
|
||||||
{deleted: {$exists: false}},
|
{deleted: {$exists: false}},
|
||||||
{deleted: {$exists: true, $eq: false}}],
|
{deleted: {$exists: true, $eq: false}}],
|
||||||
});
|
});
|
||||||
|
|
||||||
const numMySkills = await MySkill.countDocuments({idapp});
|
const numMySkills = await MySkill.countDocuments({idapp});
|
||||||
|
const numMyGoods = await MyGood.countDocuments({idapp});
|
||||||
|
|
||||||
const numMyBachecas = await MyBacheca.countDocuments({idapp});
|
const numMyBachecas = await MyBacheca.countDocuments({idapp});
|
||||||
|
|
||||||
const numGroups = await MyGroup.countDocuments({idapp});
|
const numGroups = await MyGroup.countDocuments({idapp});
|
||||||
|
|
||||||
return {numMySkills, numMyBachecas, numUsersReg, numGroups};
|
return {numMySkills, numMyGoods, numMyBachecas, numUsersReg, numGroups};
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
6
src/server/populate/adtypegoods.js
Normal file
6
src/server/populate/adtypegoods.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
list: [
|
||||||
|
{_id: 1, descr: 'Offro'},
|
||||||
|
{_id: 2, descr: 'Cerco'},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -2,71 +2,71 @@ module.exports = {
|
|||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
_id: 1,
|
_id: 1,
|
||||||
descr: "Abitare",
|
descr: 'Abitare',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 2,
|
_id: 2,
|
||||||
descr: "Arte",
|
descr: 'Arte',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 3,
|
_id: 3,
|
||||||
descr: "Alimentazione",
|
descr: 'Alimentazione',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 4,
|
_id: 4,
|
||||||
descr: "Artigianato",
|
descr: 'Artigianato',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 5,
|
_id: 5,
|
||||||
descr: "Assistenza Legale",
|
descr: 'Assistenza Legale',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 6,
|
_id: 6,
|
||||||
descr: "Benessere e Salute",
|
descr: 'Benessere e Salute',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 7,
|
_id: 7,
|
||||||
descr: "Gruppi Locali",
|
descr: 'Gruppi Locali',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 8,
|
_id: 8,
|
||||||
descr: "Istruzione",
|
descr: 'Istruzione',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 2,
|
_id: 2,
|
||||||
descr: "Arte",
|
descr: 'Arte',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 9,
|
_id: 9,
|
||||||
descr: "Mobilità",
|
descr: 'Mobilità',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 10,
|
_id: 10,
|
||||||
descr: "Sport",
|
descr: 'Sport',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 11,
|
_id: 11,
|
||||||
descr: "Servizi",
|
descr: 'Servizi',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 12,
|
_id: 12,
|
||||||
descr: "Tecnologia",
|
descr: 'Tecnologia',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 13,
|
_id: 13,
|
||||||
descr: "Turismo",
|
descr: 'Turismo',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 14,
|
_id: 14,
|
||||||
descr: "Ecovillaggi",
|
descr: 'Ecovillaggi',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 15,
|
_id: 15,
|
||||||
descr: "Feste",
|
descr: 'Feste',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: 16,
|
_id: 16,
|
||||||
descr: "Altro",
|
descr: 'Altro',
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
"_id" : ObjectID("61bc454867de9a1f54b254f2"),
|
"_id" : ObjectID("61bc454867de9a1f54b254f2"),
|
||||||
"idapp" : "12",
|
"idapp" : "12",
|
||||||
"label" : "Baratto (scambio Beni o Servizi)",
|
"label" : "Baratto",
|
||||||
"__v" : 0
|
"__v" : 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
"_id" : ObjectID("61bc482667de9a1f64b254ab"),
|
"_id" : ObjectID("61bc482667de9a1f64b254ab"),
|
||||||
"idapp" : "12",
|
"idapp" : "12",
|
||||||
"label" : "Monete Alternative",
|
"label" : "Monete Alternative (Ris, Sardex, Gaiax, Val, Cripto)",
|
||||||
"__v" : 0
|
"__v" : 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -158,31 +158,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b254ab"),
|
"_id" : ObjectID("51bc482667de9a1f64b254ab"),
|
||||||
"idapp" : "13",
|
"idapp" : "13",
|
||||||
"label" : "Monete Alternative",
|
"label" : "Monete Alternative (Ris, Sardex, Gaiax, Val, Cripto)",
|
||||||
"__v" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b254ac"),
|
|
||||||
"idapp" : "13",
|
|
||||||
"label" : "Ris (RISO)",
|
|
||||||
"__v" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b254ad"),
|
|
||||||
"idapp" : "13",
|
|
||||||
"label" : "Sardex",
|
|
||||||
"__v" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b254ae"),
|
|
||||||
"idapp" : "13",
|
|
||||||
"label" : "Gaiax (ProItaly)",
|
|
||||||
"__v" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b254af"),
|
|
||||||
"idapp" : "13",
|
|
||||||
"label" : "Val (VAL.AZ.CO.)",
|
|
||||||
"__v" : 0
|
"__v" : 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -191,11 +167,5 @@ module.exports = {
|
|||||||
"label" : "Euro",
|
"label" : "Euro",
|
||||||
"__v" : 0
|
"__v" : 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"_id" : ObjectID("51bc482667de9a1f64b257fb"),
|
|
||||||
"idapp" : "13",
|
|
||||||
"label" : "Criptomonete",
|
|
||||||
"__v" : 0
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
58
src/server/populate/goods.js
Normal file
58
src/server/populate/goods.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
module.exports = {
|
||||||
|
list: [
|
||||||
|
{_id: 1, idSectorGood: [1], descr: 'Abbigliamento donna'},
|
||||||
|
{_id: 2, idSectorGood: [1], descr: 'Abbigliamento uomo'},
|
||||||
|
{_id: 3, idSectorGood: [1], descr: 'Accessori'},
|
||||||
|
{_id: 4, idSectorGood: [1], descr: 'Scarpe donna'},
|
||||||
|
{_id: 5, idSectorGood: [1], descr: 'Scarpe uomo'},
|
||||||
|
{_id: 6, idSectorGood: [2], descr: 'Bagno'},
|
||||||
|
{_id: 7, idSectorGood: [2], descr: 'Camera'},
|
||||||
|
{_id: 8, idSectorGood: [2], descr: 'Complementi d\'arredo'},
|
||||||
|
{_id: 9, idSectorGood: [2], descr: 'Cucina'},
|
||||||
|
{_id: 10, idSectorGood: [2], descr: 'Esterno'},
|
||||||
|
{_id: 11, idSectorGood: [2], descr: 'Soggiorno'},
|
||||||
|
{_id: 12, idSectorGood: [3], descr: 'Altri veicoli'},
|
||||||
|
{_id: 13, idSectorGood: [3], descr: 'Auto'},
|
||||||
|
{_id: 14, idSectorGood: [3], descr: 'Moto'},
|
||||||
|
{_id: 15, idSectorGood: [3], descr: 'Camper'},
|
||||||
|
{_id: 16, idSectorGood: [3], descr: 'Van (furgoni camperizzati)'},
|
||||||
|
{_id: 17, idSectorGood: [4], descr: 'Bigiotteria'},
|
||||||
|
{_id: 18, idSectorGood: [4], descr: 'Lavoretti'},
|
||||||
|
{_id: 19, idSectorGood: [4], descr: 'Mangia e bevi'},
|
||||||
|
{_id: 20, idSectorGood: [5], descr: 'Accessori bellezza'},
|
||||||
|
{_id: 21, idSectorGood: [5], descr: 'Creme e detergenti'},
|
||||||
|
{_id: 22, idSectorGood: [5], descr: 'Trucchi e profumi'},
|
||||||
|
{_id: 23, idSectorGood: [6], descr: 'Giocattoli e giochi di società'},
|
||||||
|
{_id: 24, idSectorGood: [6], descr: 'Igiene e pannolini'},
|
||||||
|
{_id: 25, idSectorGood: [6], descr: 'Lettini e culle'},
|
||||||
|
{_id: 26, idSectorGood: [6], descr: 'Passeggini & co'},
|
||||||
|
{_id: 27, idSectorGood: [6], descr: 'Vestiti e scarpe'},
|
||||||
|
{_id: 28, idSectorGood: [7], descr: 'Bere'},
|
||||||
|
{_id: 29, idSectorGood: [7], descr: 'Mangiare'},
|
||||||
|
{_id: 30, idSectorGood: [8], descr: 'Antiquariato'},
|
||||||
|
{_id: 31, idSectorGood: [8], descr: 'Collezionismo'},
|
||||||
|
{_id: 32, idSectorGood: [9], descr: 'Altro'},
|
||||||
|
{_id: 33, idSectorGood: [9], descr: 'Cellulari e accessori'},
|
||||||
|
{_id: 34, idSectorGood: [9], descr: 'Computer e software'},
|
||||||
|
{_id: 35, idSectorGood: [9], descr: 'Elettrodomestici'},
|
||||||
|
{_id: 36, idSectorGood: [9], descr: 'Fotografia'},
|
||||||
|
{_id: 37, idSectorGood: [9], descr: 'Videogiochi e console'},
|
||||||
|
{_id: 38, idSectorGood: [10], descr: 'Console'},
|
||||||
|
{_id: 39, idSectorGood: [10], descr: 'Giochi di società'},
|
||||||
|
{_id: 40, idSectorGood: [10], descr: 'PC games'},
|
||||||
|
{_id: 41, idSectorGood: [11], descr: 'Attrezzatura'},
|
||||||
|
{_id: 42, idSectorGood: [11], descr: 'Materiali'},
|
||||||
|
{_id: 43, idSectorGood: [11], descr: 'Prodotti'},
|
||||||
|
{_id: 44, idSectorGood: [11], descr: 'Strumentazione'},
|
||||||
|
{_id: 45, idSectorGood: [12], descr: ' riviste e fumetti'},
|
||||||
|
{_id: 46, idSectorGood: [13], descr: 'CD e vinili'},
|
||||||
|
{_id: 47, idSectorGood: [13], descr: 'Film e DVD'},
|
||||||
|
{_id: 48, idSectorGood: [13], descr: 'Strumenti musicali'},
|
||||||
|
{_id: 49, idSectorGood: [14], descr: 'Arredamento'},
|
||||||
|
{_id: 50, idSectorGood: [14], descr: 'Attrezzature e accessori'},
|
||||||
|
{_id: 51, idSectorGood: [14], descr: 'Cancelleria e cartucce'},
|
||||||
|
{_id: 52, idSectorGood: [15], descr: 'Abbigliamento'},
|
||||||
|
{_id: 53, idSectorGood: [15], descr: 'Attrezzature e accessori Sport'},
|
||||||
|
{_id: 54, idSectorGood: [15], descr: 'Bici e accessori'},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -2,7 +2,7 @@ module.exports = {
|
|||||||
list: [
|
list: [
|
||||||
{_id: 0, descr: '[Nessuno]', years_of_exp: 0},
|
{_id: 0, descr: '[Nessuno]', years_of_exp: 0},
|
||||||
{_id: 1, descr: 'Elementare', years_of_exp: 1},
|
{_id: 1, descr: 'Elementare', years_of_exp: 1},
|
||||||
{_id: 2, descr: 'Intermedio', years_of_exp: 3},
|
{_id: 2, descr: 'Intermedio', years_of_exp: 2},
|
||||||
{_id: 3, descr: 'Avanzato', years_of_exp: 5},
|
{_id: 3, descr: 'Avanzato', years_of_exp: 3},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
|
|
||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
const Path = require('path')
|
const Path = require('path');
|
||||||
|
|
||||||
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
|
const globalTables = require('../tools/globalTables');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
@@ -18,7 +23,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.log('error insertIntoDb', e);
|
console.log('error insertIntoDb', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +44,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (mydbfile && mydbfile.list) {
|
if (mydbfile && mydbfile.list) {
|
||||||
for (const rec of mydbfile.list) {
|
for (const rec of mydbfile.list) {
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj[field] = rec[field];
|
obj[field] = rec[field];
|
||||||
|
|
||||||
var mynewrec = new table(rec);
|
var mynewrec = new table(rec);
|
||||||
@@ -55,24 +60,22 @@ module.exports = {
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
numrec++;
|
numrec++;
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.log('error ', e);
|
console.log('error ', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//await table.insertMany(rec, {ordered: false});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numrec > 0)
|
if (numrec > 0)
|
||||||
console.log('*** Insert', numrec, 'record on '+tablename);
|
console.log('*** Insert', numrec, 'record on ' + tablename);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.log('error insertIntoDb', e);
|
console.log('error insertIntoDb', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async rewriteTable(table) {
|
async rewriteTable(table) {
|
||||||
@@ -80,102 +83,89 @@ module.exports = {
|
|||||||
let mytab = null;
|
let mytab = null;
|
||||||
let field = '';
|
let field = '';
|
||||||
|
|
||||||
const {City} = require('../models/city');
|
try {
|
||||||
const {Province} = require('../models/province');
|
const {City} = require('../models/city');
|
||||||
const {Sector} = require('../models/sector');
|
const {Province} = require('../models/province');
|
||||||
const {Skill} = require('../models/skill');
|
const {Sector} = require('../models/sector');
|
||||||
const {SubSkill} = require('../models/subskill');
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
const {Contribtype} = require('../models/contribtype');
|
const {Skill} = require('../models/skill');
|
||||||
const {Level} = require('../models/level');
|
const {Good} = require('../models/good');
|
||||||
|
// const {SubSkill} = require('../models/subskill');
|
||||||
|
const {Contribtype} = require('../models/contribtype');
|
||||||
|
const {Level} = require('../models/level');
|
||||||
|
|
||||||
if (table === 'cities') {
|
if (table === 'cities') {
|
||||||
mytab = City;
|
mytab = City;
|
||||||
field = 'comune';
|
field = 'comune';
|
||||||
} else if (table === 'provinces') {
|
} else if (table === 'provinces') {
|
||||||
mytab = Province;
|
mytab = Province;
|
||||||
field = 'descr';
|
field = 'descr';
|
||||||
} else if (table === 'sectors') {
|
} else if (table === 'sectors') {
|
||||||
mytab = Sector;
|
mytab = Sector;
|
||||||
field = 'descr';
|
field = 'descr';
|
||||||
} else if (table === 'skills') {
|
} else if (table === 'sectorgoods') {
|
||||||
mytab = Skill;
|
mytab = SectorGood;
|
||||||
field = 'descr';
|
field = 'descr';
|
||||||
} else if (table === 'subskills') {
|
} else if (table === 'skills') {
|
||||||
mytab = SubSkill;
|
mytab = Skill;
|
||||||
field = 'descr';
|
field = 'descr';
|
||||||
} else if (table === 'contribtypes') {
|
} else if (table === 'goods') {
|
||||||
mytab = Contribtype;
|
mytab = Good;
|
||||||
field = 'label';
|
field = 'descr';
|
||||||
} else if (table === 'levels') {
|
//} else if (table === 'subskills') {
|
||||||
mytab = Level;
|
// mytab = SubSkill;
|
||||||
field = 'descr';
|
// field = 'descr';
|
||||||
|
} else if (table === 'contribtypes') {
|
||||||
|
mytab = Contribtype;
|
||||||
|
field = 'label';
|
||||||
|
} else if (table === 'levels') {
|
||||||
|
mytab = Level;
|
||||||
|
field = 'descr';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mytab) {
|
||||||
|
console.log('Delete ', table);
|
||||||
|
await mytab.deleteMany({});
|
||||||
|
|
||||||
|
await this.insertIntoDb_NoDuplicate(false, table, mytab, field);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err: ' + e);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if (mytab) {
|
|
||||||
console.log('Delete ', table)
|
|
||||||
await mytab.deleteMany({});
|
|
||||||
|
|
||||||
await this.insertIntoDb_NoDuplicate(false, table, mytab, field)
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async popolaTabelleNuove() {
|
async popolaTabelleNuove() {
|
||||||
const abilita = true;
|
const abilita = true;
|
||||||
const scrivi_citta = false;
|
const scrivi_citta = false;
|
||||||
|
const scrivi_contribtype = false;
|
||||||
|
|
||||||
let ris = null;
|
let ris = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
console.log('INIZIO - popolaTabelleNuove');
|
||||||
|
|
||||||
console.log('INIZIO - popolaTabelleNuove')
|
for (const rec of shared_consts.TABLES_POPULATE_DATA) {
|
||||||
|
let mytable = globalTables.getTableByTableName(rec.table);
|
||||||
|
|
||||||
// Sectors
|
let attiva = abilita;
|
||||||
const {Sector} = require('../models/sector');
|
if (rec.table === 'cities' || rec.table === 'province') {
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'sectors', Sector, 'descr')
|
attiva = scrivi_citta;
|
||||||
|
}
|
||||||
|
if (rec.table === 'contribtypes') {
|
||||||
|
attiva = scrivi_contribtype;
|
||||||
|
}
|
||||||
|
|
||||||
// CatGrps
|
await this.insertIntoDb_NoDuplicate(attiva, rec.table, mytable, rec.key);
|
||||||
const {CatGrp} = require('../models/catgrp');
|
}
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'catgrps', CatGrp, 'descr')
|
|
||||||
|
|
||||||
// Skills (Competenze)
|
console.log('FINE - popolaTabelleNuove');
|
||||||
const {Skill} = require('../models/skill');
|
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'skills', Skill, 'descr')
|
|
||||||
|
|
||||||
// SubSectors
|
return true;
|
||||||
const {SubSkill} = require('../models/subskill');
|
} catch (e) {
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'subskills', SubSkill, 'descr')
|
|
||||||
|
|
||||||
// Levels
|
|
||||||
const {Level} = require('../models/level');
|
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'levels', Level, 'descr')
|
|
||||||
|
|
||||||
// Status
|
|
||||||
const {StatusSkill} = require('../models/statusSkill');
|
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'statusskills', StatusSkill, 'descr')
|
|
||||||
|
|
||||||
// Cities
|
|
||||||
const {City} = require('../models/city');
|
|
||||||
await this.insertIntoDb_NoDuplicate(scrivi_citta, 'cities', City, 'comune')
|
|
||||||
|
|
||||||
// Province
|
|
||||||
const {Province} = require('../models/province');
|
|
||||||
await this.insertIntoDb_NoDuplicate(scrivi_citta, 'provinces', Province, 'descr')
|
|
||||||
|
|
||||||
// Contribtypes
|
|
||||||
const {Contribtype} = require('../models/contribtype');
|
|
||||||
await this.insertIntoDb_NoDuplicate(false, 'contribtypes', Contribtype, 'label')
|
|
||||||
|
|
||||||
// AdTypes
|
|
||||||
const {AdType} = require('../models/adtype');
|
|
||||||
await this.insertIntoDb_NoDuplicate(abilita, 'adtypes', AdType, 'descr')
|
|
||||||
|
|
||||||
console.log('FINE - popolaTabelleNuove')
|
|
||||||
|
|
||||||
}catch (e) {
|
|
||||||
console.error('Err: ' + e);
|
console.error('Err: ' + e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
19
src/server/populate/sectorgoods.js
Normal file
19
src/server/populate/sectorgoods.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
module.exports = {
|
||||||
|
list: [
|
||||||
|
{_id: 1, descr: 'Abbigliamento'},
|
||||||
|
{_id: 2, descr: 'Arredamento'},
|
||||||
|
{_id: 3, descr: 'Auto e Moto'},
|
||||||
|
{_id: 4, descr: 'Autoproduzione'},
|
||||||
|
{_id: 5, descr: 'Bellezza e igiene'},
|
||||||
|
{_id: 6, descr: 'Bimbi'},
|
||||||
|
{_id: 7, descr: 'Cibo'},
|
||||||
|
{_id: 8, descr: 'Collezionismo e Antiquariato'},
|
||||||
|
{_id: 9, descr: 'Elettronica'},
|
||||||
|
{_id: 10, descr: 'Giochi'},
|
||||||
|
{_id: 11, descr: 'Hobby'},
|
||||||
|
{_id: 12, descr: 'Libri'},
|
||||||
|
{_id: 13, descr: 'Musica e film'},
|
||||||
|
{_id: 14, descr: 'Scuola e ufficio'},
|
||||||
|
{_id: 15, descr: 'Sport'},
|
||||||
|
{_id: 16, descr: 'Un po\' di tutto'}],
|
||||||
|
};
|
||||||
@@ -1,31 +1,17 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
list: [
|
list: [
|
||||||
{
|
{_id: 1, descr: 'Abitare'},
|
||||||
descr: 'Abitare',
|
{_id: 2, descr: 'Agricoltura'},
|
||||||
},
|
{_id: 3, descr: 'Alimentazione'},
|
||||||
{
|
{_id: 4, descr: 'Animali'},
|
||||||
descr: 'Alimentazione',
|
{_id: 5, descr: 'Auto e Veicoli'},
|
||||||
},
|
{_id: 6, descr: 'Benessere'},
|
||||||
{
|
{_id: 7, descr: 'Casa'},
|
||||||
descr: 'Animali',
|
{_id: 8, descr: 'Intrattenimento'},
|
||||||
},
|
{_id: 9, descr: 'Ospitalità'},
|
||||||
{
|
{_id: 10, descr: 'Persona'},
|
||||||
descr: 'Arte e Cultura',
|
{_id: 11, descr: 'Progetti di Gruppo'},
|
||||||
},
|
{_id: 12, descr: 'Salute'},
|
||||||
{
|
{_id: 13, descr: 'Tecnologia'},
|
||||||
descr: 'Benessere e Salute',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
descr: 'Servizi per la Casa',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
descr: 'Servizi per la Persona',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
descr: 'Tecnologia',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
descr: 'Turismo',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,108 +1,106 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
list: [
|
list: [
|
||||||
{idSector: [1], descr: 'Arredamento'},
|
{_id: 1, idSector: [1], descr: 'Autocostruzione'},
|
||||||
{idSector: [1], descr: 'Costruzioni'},
|
{_id: 2, idSector: [1], descr: 'Ecovillaggi / Comunità'},
|
||||||
{idSector: [1], descr: 'Ecovillaggi / Comunità'},
|
{_id: 3, idSector: [1], descr: 'Cohousing'},
|
||||||
{idSector: [1], descr: 'Giardini'},
|
{_id: 4, idSector: [2], descr: 'Orto sinergico'},
|
||||||
{idSector: [1], descr: 'Impianti TV'},
|
{_id: 5, idSector: [2], descr: 'Pacciamatura'},
|
||||||
{idSector: [1], descr: 'Pozzi Acqua'},
|
{_id: 6, idSector: [2], descr: 'Orto tradizionale'},
|
||||||
{idSector: [1], descr: 'Prodotti Casa'},
|
{_id: 7, idSector: [2], descr: 'Permacultura'},
|
||||||
{idSector: [1], descr: 'Pulizie'},
|
{_id: 8, idSector: [2], descr: 'Cultura idroponica'},
|
||||||
{idSector: [1], descr: 'Restaurazioni'},
|
{_id: 9, idSector: [2], descr: 'Elettrocultura'},
|
||||||
{idSector: [1], descr: 'Riparazioni'},
|
{_id: 10, idSector: [2], descr: 'Aratura + semina'},
|
||||||
{idSector: [1], descr: 'Servizi Casa'},
|
{_id: 11, idSector: [2], descr: 'Potatura'},
|
||||||
{idSector: [1], descr: 'Sgombero'},
|
{_id: 12, idSector: [2], descr: 'Raccolta'},
|
||||||
{idSector: [1], descr: 'Sicurezza'},
|
{_id: 13, idSector: [3], descr: 'Preparazione cibi'},
|
||||||
{idSector: [2], descr: 'Agricoltura'},
|
{_id: 14, idSector: [3], descr: 'Preparazione bevande'},
|
||||||
{idSector: [2], descr: 'Alimentari'},
|
{_id: 15, idSector: [3], descr: 'Autoproduzione alimenti e bevande'},
|
||||||
{idSector: [2], descr: 'Cucina'},
|
{_id: 16, idSector: [4], descr: 'Servizi per Cani'},
|
||||||
{idSector: [2], descr: 'Altro'},
|
{_id: 17, idSector: [4], descr: 'Servizi per Gatti'},
|
||||||
{idSector: [2], descr: 'Autoproduzioni'},
|
{_id: 18, idSector: [4], descr: 'Servizi per Anumali da allevamento'},
|
||||||
{idSector: [2], descr: 'Azienda Agricola'},
|
{_id: 19, idSector: [4], descr: 'Veterinario'},
|
||||||
{idSector: [3], descr: 'Dog sitter'},
|
{_id: 20, idSector: [5], descr: 'Riparazioni Auto'},
|
||||||
{idSector: [3], descr: 'Pet sitter'},
|
{_id: 21, idSector: [5], descr: 'Riparazioni Moto'},
|
||||||
{idSector: [3], descr: 'Toelettatura cani'},
|
{_id: 22, idSector: [5], descr: 'Riparazioni Camper / Van'},
|
||||||
{idSector: [3], descr: 'Toelettatura gatti'},
|
{_id: 23, idSector: [5], descr: 'Creazione di Van Camperizzati'},
|
||||||
{idSector: [3], descr: 'Vendita prodotti'},
|
{_id: 24, idSector: [5], descr: 'Noleggio veicoli'},
|
||||||
{idSector: [3], descr: 'Cura degli animali'},
|
{_id: 25, idSector: [5], descr: 'Lavaggio auto'},
|
||||||
{idSector: [3], descr: 'Veterinario'},
|
{_id: 26, idSector: [6], descr: 'Alimentazione Naturale'},
|
||||||
{idSector: [4], descr: 'Ballo'},
|
{_id: 27, idSector: [6], descr: 'Ginnastica'},
|
||||||
{idSector: [4], descr: 'Canto'},
|
{_id: 28, idSector: [6], descr: 'Yoga'},
|
||||||
{idSector: [4], descr: 'Cinema'},
|
{_id: 29, idSector: [6], descr: 'Trattamenti Olistici'},
|
||||||
{idSector: [4], descr: 'Fotografia'},
|
{_id: 30, idSector: [6], descr: 'Meditazione e mindfulness'},
|
||||||
{idSector: [4], descr: 'Letteratura'},
|
{_id: 31, idSector: [6], descr: 'Trattamenti Energetici'},
|
||||||
{idSector: [4], descr: 'Musica'},
|
{_id: 32, idSector: [6], descr: 'Trattamenti Sonori'},
|
||||||
{idSector: [4], descr: 'Pittura'},
|
{_id: 33, idSector: [6], descr: 'Arteterapia'},
|
||||||
{idSector: [4], descr: 'Libri'},
|
{_id: 34, idSector: [6], descr: 'Teatroterapia'},
|
||||||
{idSector: [4], descr: 'Teatro'},
|
{_id: 35, idSector: [6], descr: 'Cantoterapia'},
|
||||||
{idSector: [4], descr: 'Moda'},
|
{_id: 36, idSector: [6], descr: 'Trattamenti Luminosi'},
|
||||||
{idSector: [5], descr: 'Benessere Corpo'},
|
{_id: 37, idSector: [6], descr: 'Fitoterapia'},
|
||||||
{idSector: [5], descr: 'Benessere Olistico'},
|
{_id: 38, idSector: [6], descr: 'Kinesiologia'},
|
||||||
{idSector: [5], descr: 'Centro Benessere'},
|
{_id: 39, idSector: [6], descr: 'Terapie Naturali'},
|
||||||
{idSector: [5], descr: 'Gravidanza'},
|
{_id: 40, idSector: [7], descr: 'Muratore'},
|
||||||
{idSector: [5], descr: 'Medicina Alternativa'},
|
{_id: 41, idSector: [7], descr: 'Imbianchino'},
|
||||||
{idSector: [5], descr: 'Medicina Convenzionale'},
|
{_id: 42, idSector: [7], descr: 'Elettricista - TV'},
|
||||||
{idSector: [5], descr: 'Pronto Soccorso'},
|
{_id: 43, idSector: [7], descr: 'Falegname e restauro'},
|
||||||
{idSector: [5], descr: 'Operatore Olistico'},
|
{_id: 44, idSector: [7], descr: 'Fabbro'},
|
||||||
{idSector: [5], descr: 'Operatori Sanitari'},
|
{_id: 45, idSector: [7], descr: 'Arredamento'},
|
||||||
{idSector: [5], descr: 'Salute Corpo'},
|
{_id: 46, idSector: [7], descr: 'Idraulico'},
|
||||||
{idSector: [5], descr: 'Salute Globale'},
|
{_id: 47, idSector: [7], descr: 'Giardiniere'},
|
||||||
{idSector: [5], descr: 'Salute Psiche'},
|
{_id: 48, idSector: [7], descr: 'Canne fumarie e camini e stufe'},
|
||||||
{idSector: [5], descr: 'Servizi per la Persona'},
|
{_id: 49, idSector: [7], descr: 'Pannelli solari e pompe calore'},
|
||||||
{idSector: [5], descr: 'Strutture'},
|
{_id: 50, idSector: [7], descr: 'Riparazioni varie'},
|
||||||
{idSector: [6], descr: 'Aspetti Burocratici'},
|
{_id: 51, idSector: [7], descr: 'Tuttofare'},
|
||||||
{idSector: [6], descr: 'Elettricista'},
|
{_id: 52, idSector: [7], descr: 'Traslochi'},
|
||||||
{idSector: [6], descr: 'Fabbro e lavorazioni ferro/acciaio'},
|
{_id: 53, idSector: [7], descr: 'Piastrellista'},
|
||||||
{idSector: [6], descr: 'Falegname'},
|
{_id: 54, idSector: [7], descr: 'Pulizie'},
|
||||||
{idSector: [6], descr: 'Frigorista'},
|
{_id: 55, idSector: [8], descr: 'Ballo'},
|
||||||
{idSector: [6], descr: 'Giardiniere'},
|
{_id: 56, idSector: [8], descr: 'Canto'},
|
||||||
{idSector: [6], descr: 'Idraulico'},
|
{_id: 57, idSector: [8], descr: 'Musica'},
|
||||||
{idSector: [6], descr: 'Imbianchino'},
|
{_id: 58, idSector: [8], descr: 'Letteratura e poesia'},
|
||||||
{idSector: [6], descr: 'Impermeabilizzazioni'},
|
{_id: 59, idSector: [8], descr: 'Teatro'},
|
||||||
{idSector: [6], descr: 'Installatore Linea Telefono e Modem'},
|
{_id: 60, idSector: [8], descr: 'Fotografia'},
|
||||||
{idSector: [6], descr: 'Installazioni'},
|
{_id: 61, idSector: [8], descr: 'Film making'},
|
||||||
{idSector: [6], descr: 'Restaurazione'},
|
{_id: 62, idSector: [8], descr: 'Sport'},
|
||||||
{idSector: [6], descr: 'Riparazioni Casa'},
|
{_id: 63, idSector: [8], descr: 'Arte'},
|
||||||
{idSector: [6], descr: 'Servizio Traslochi'},
|
{_id: 64, idSector: [9], descr: 'Offresi Ospitalità'},
|
||||||
{idSector: [6], descr: 'Riscaldamento'},
|
{_id: 65, idSector: [9], descr: 'Affitto casa'},
|
||||||
{idSector: [6], descr: 'Smontaggio e Montaggio'},
|
{_id: 66, idSector: [9], descr: 'Affittacamere'},
|
||||||
{idSector: [6], descr: 'Strutturazioni e Riparazioni'},
|
{_id: 67, idSector: [9], descr: 'Affitto mini appartamento'},
|
||||||
{idSector: [6], descr: 'Tuttofare'},
|
{_id: 68, idSector: [9], descr: 'Bed & Breakfast'},
|
||||||
{idSector: [6], descr: 'Vetraio'},
|
{_id: 69, idSector: [9], descr: 'Scambio Casa'},
|
||||||
{idSector: [7], descr: 'Abbigliamento'},
|
{_id: 70, idSector: [10], descr: 'Parrucchiere'},
|
||||||
{idSector: [7], descr: 'Assicurazioni'},
|
{_id: 71, idSector: [10], descr: 'Estetista'},
|
||||||
{idSector: [7], descr: 'Assistenza Anziani'},
|
{_id: 72, idSector: [10], descr: 'Omeopatia'},
|
||||||
{idSector: [7], descr: 'Assistenza Fiscale'},
|
{_id: 73, idSector: [10], descr: 'Assistenza anziani'},
|
||||||
{idSector: [7], descr: 'Assistenza Legale'},
|
{_id: 74, idSector: [10], descr: 'Contabile/commercialista'},
|
||||||
{idSector: [7], descr: 'Assistenza Persone'},
|
{_id: 75, idSector: [10], descr: 'Avvocato'},
|
||||||
{idSector: [7], descr: 'Baby sitter'},
|
{_id: 76, idSector: [10], descr: 'Baby sitter'},
|
||||||
{idSector: [7], descr: 'Corsi'},
|
{_id: 77, idSector: [10], descr: 'Sarto'},
|
||||||
{idSector: [7], descr: 'Corsi per Bambini e Adolescenti'},
|
{_id: 78, idSector: [10], descr: 'Autoproduzione prodotti persona'},
|
||||||
{idSector: [7], descr: 'Finanza'},
|
{_id: 79, idSector: [10], descr: 'Corsi e Formazione'},
|
||||||
{idSector: [7], descr: 'Insegnante'},
|
{_id: 80, idSector: [10], descr: 'Supporto spesa'},
|
||||||
{idSector: [7], descr: 'Interprete e traduzioni'},
|
{_id: 81, idSector: [10], descr: 'Volontariato'},
|
||||||
{idSector: [7], descr: 'Educazione'},
|
{_id: 82, idSector: [11], descr: 'Gruppi di acquisto'},
|
||||||
{idSector: [7], descr: 'Formazione'},
|
{_id: 83, idSector: [11], descr: 'Banca del tempo'},
|
||||||
{idSector: [7], descr: 'Gruppi di Acquisto'},
|
{_id: 84, idSector: [11], descr: 'Collabora con noi'},
|
||||||
{idSector: [7], descr: 'Banca del Tempo'},
|
{_id: 85, idSector: [11], descr: 'Eventi'},
|
||||||
{idSector: [7], descr: 'Collabora con noi'},
|
{_id: 86, idSector: [11], descr: 'Laboratori'},
|
||||||
{idSector: [7], descr: 'Eventi'},
|
{_id: 87, idSector: [11], descr: 'Idee e suggerimenti'},
|
||||||
{idSector: [7], descr: 'Laboratori'},
|
{_id: 88, idSector: [12], descr: 'Medico di base '},
|
||||||
{idSector: [7], descr: 'Idee'},
|
{_id: 89, idSector: [12], descr: 'Specialista'},
|
||||||
{idSector: [7], descr: 'Progetti'},
|
{_id: 90, idSector: [12], descr: 'Pediatra'},
|
||||||
{idSector: [7], descr: 'Mobilità'},
|
{_id: 91, idSector: [12], descr: 'Dentista'},
|
||||||
{idSector: [7], descr: 'Oggettistica'},
|
{_id: 92, idSector: [12], descr: 'Psicologo'},
|
||||||
{idSector: [7], descr: 'Solidarietà'},
|
{_id: 93, idSector: [12], descr: 'Psicoterapeuta'},
|
||||||
{idSector: [7], descr: 'Sport'},
|
{_id: 94, idSector: [12], descr: 'Ostetrica'},
|
||||||
{idSector: [7], descr: 'Trasporti'},
|
{_id: 95, idSector: [12], descr: 'Nutrizionista'},
|
||||||
{idSector: [8], descr: 'Audio/Video'},
|
{_id: 96, idSector: [12], descr: 'Naturopata'},
|
||||||
{idSector: [8], descr: 'Biologia'},
|
{_id: 97, idSector: [12], descr: 'Counseling'},
|
||||||
{idSector: [8], descr: 'Chimica'},
|
{_id: 98, idSector: [13], descr: 'Assistenza PC / software'},
|
||||||
{idSector: [8], descr: 'Informatica'},
|
{_id: 99, idSector: [13], descr: 'Assistenza Cellulari'},
|
||||||
{idSector: [8], descr: 'Elettronica'},
|
{_id: 100, idSector: [13], descr: 'Realizzazione Siti web'},
|
||||||
{idSector: [8], descr: 'Meccanica'},
|
{_id: 101, idSector: [13], descr: 'Realizzazione App / Piattaforme'},
|
||||||
{idSector: [8], descr: 'Telefonia'},
|
{_id: 102, idSector: [13], descr: 'Corsi d\'Informatica'},
|
||||||
{idSector: [9], descr: 'Vacanze'},
|
{_id: 103, idSector: [13], descr: 'Riparazione Elettrodomestici'}],
|
||||||
{idSector: [9], descr: 'Receptionist'}
|
};
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|||||||
6
src/server/populate/statusSkills.js
Normal file
6
src/server/populate/statusSkills.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
list: [
|
||||||
|
{_id: 1, descr: 'Di Persona', icon:'fas fa-people-carry' },
|
||||||
|
{_id: 2, descr: 'On Line', icon:'fas fa-desktop'},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
list: [
|
|
||||||
{_id: 1, descr: 'Di Persona'},
|
|
||||||
{_id: 2, descr: 'On Line'},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -46,15 +46,19 @@ const {Contribtype} = require('../models/contribtype');
|
|||||||
const {PaymentType} = require('../models/paymenttype');
|
const {PaymentType} = require('../models/paymenttype');
|
||||||
const {Discipline} = require('../models/discipline');
|
const {Discipline} = require('../models/discipline');
|
||||||
const {Skill} = require('../models/skill');
|
const {Skill} = require('../models/skill');
|
||||||
|
const {Good} = require('../models/good');
|
||||||
const {SubSkill} = require('../models/subskill');
|
const {SubSkill} = require('../models/subskill');
|
||||||
const {MySkill} = require('../models/myskill');
|
const {MySkill} = require('../models/myskill');
|
||||||
|
const {MyGood} = require('../models/mygood');
|
||||||
const {StatusSkill} = require('../models/statusSkill');
|
const {StatusSkill} = require('../models/statusSkill');
|
||||||
const {City} = require('../models/city');
|
const {City} = require('../models/city');
|
||||||
const {Province} = require('../models/province');
|
const {Province} = require('../models/province');
|
||||||
const {Sector} = require('../models/sector');
|
const {Sector} = require('../models/sector');
|
||||||
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
const {CatGrp} = require('../models/catgrp');
|
const {CatGrp} = require('../models/catgrp');
|
||||||
const {Level} = require('../models/level');
|
const {Level} = require('../models/level');
|
||||||
const {AdType} = require('../models/adtype');
|
const {AdType} = require('../models/adtype');
|
||||||
|
const {AdTypeGood} = require('../models/adtypegood');
|
||||||
const Pickup = require('../models/pickup');
|
const Pickup = require('../models/pickup');
|
||||||
const {Newstosent} = require('../models/newstosent');
|
const {Newstosent} = require('../models/newstosent');
|
||||||
const {MyPage} = require('../models/mypage');
|
const {MyPage} = require('../models/mypage');
|
||||||
@@ -1021,10 +1025,13 @@ function load(req, res, version) {
|
|||||||
// SKILLS:
|
// SKILLS:
|
||||||
let levels = Level.findAllIdApp(idapp);
|
let levels = Level.findAllIdApp(idapp);
|
||||||
let adtypes = AdType.findAllIdApp(idapp);
|
let adtypes = AdType.findAllIdApp(idapp);
|
||||||
|
let adtypegoods = AdTypeGood.findAllIdApp(idapp);
|
||||||
let skills = Skill.findAllIdApp(idapp);
|
let skills = Skill.findAllIdApp(idapp);
|
||||||
let subSkills = SubSkill.findAllIdApp(idapp);
|
let goods = Good.findAllIdApp(idapp);
|
||||||
|
//let subSkills = SubSkill.findAllIdApp(idapp);
|
||||||
let statusSkills = StatusSkill.findAllIdApp(idapp);
|
let statusSkills = StatusSkill.findAllIdApp(idapp);
|
||||||
let sectors = Sector.findAllIdApp(idapp);
|
let sectors = Sector.findAllIdApp(idapp);
|
||||||
|
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
||||||
let catgrps = CatGrp.findAllIdApp(idapp);
|
let catgrps = CatGrp.findAllIdApp(idapp);
|
||||||
let cities = City.findAllIdApp(idapp);
|
let cities = City.findAllIdApp(idapp);
|
||||||
let cart = null;
|
let cart = null;
|
||||||
@@ -1078,19 +1085,22 @@ function load(req, res, version) {
|
|||||||
internalpages,
|
internalpages,
|
||||||
levels,
|
levels,
|
||||||
skills,
|
skills,
|
||||||
subSkills,
|
//subSkills,
|
||||||
|
myuserextra,
|
||||||
sectors,
|
sectors,
|
||||||
statusSkills,
|
statusSkills,
|
||||||
cities,
|
cities,
|
||||||
myuserextra,
|
|
||||||
catgrps,
|
catgrps,
|
||||||
adtypes,
|
adtypes,
|
||||||
|
adtypegoods,
|
||||||
|
sectorgoods,
|
||||||
|
goods,
|
||||||
]).then((arrdata) => {
|
]).then((arrdata) => {
|
||||||
// console.table(arrdata);
|
// console.table(arrdata);
|
||||||
let myuser = req.user;
|
let myuser = req.user;
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
try {
|
try {
|
||||||
myuser = arrdata[30];
|
myuser = arrdata[26];
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
myuser.password = '';
|
myuser.password = '';
|
||||||
myuser._doc.calcstat = arrdata[13];
|
myuser._doc.calcstat = arrdata[13];
|
||||||
@@ -1152,13 +1162,16 @@ function load(req, res, version) {
|
|||||||
internalpages: arrdata[23],
|
internalpages: arrdata[23],
|
||||||
levels: arrdata[24],
|
levels: arrdata[24],
|
||||||
skills: arrdata[25],
|
skills: arrdata[25],
|
||||||
subSkills: arrdata[26],
|
// subSkills: arrdata[26],
|
||||||
|
// myuser arrdata[26]
|
||||||
sectors: arrdata[27],
|
sectors: arrdata[27],
|
||||||
statusSkills: arrdata[28],
|
statusSkills: arrdata[28],
|
||||||
cities: arrdata[29],
|
cities: arrdata[29],
|
||||||
// myuser arrdata[30]
|
catgrps: arrdata[30],
|
||||||
catgrps: arrdata[31],
|
adtypes: arrdata[31],
|
||||||
adtypes: arrdata[32],
|
adtypegoods: arrdata[32],
|
||||||
|
sectorgoods: arrdata[33],
|
||||||
|
goods: arrdata[34],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
50
src/server/router/mygoods_router.js
Executable file
50
src/server/router/mygoods_router.js
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
var server_constants = require('../tools/server_constants');
|
||||||
|
|
||||||
|
var {authenticate, auth_default} = require('../middleware/authenticate');
|
||||||
|
|
||||||
|
var mongoose = require('mongoose').set('debug', false);
|
||||||
|
const Subscription = mongoose.model('subscribers');
|
||||||
|
|
||||||
|
const _ = require('lodash');
|
||||||
|
const {MyGood} = require('../models/mygood');
|
||||||
|
var {User} = require('../models/user');
|
||||||
|
|
||||||
|
const {ObjectID} = require('mongodb');
|
||||||
|
|
||||||
|
//GET orders
|
||||||
|
router.post('/page', authenticate, function(req, res, next) {
|
||||||
|
let idGood = req.body.idGood;
|
||||||
|
let idapp = req.body.idapp;
|
||||||
|
|
||||||
|
return MyGood.getMyGoodByIdkill(idapp, idGood).
|
||||||
|
then((ris) => {
|
||||||
|
|
||||||
|
if (ris) {
|
||||||
|
res.send(ris);
|
||||||
|
/*
|
||||||
|
const userId = ris.userId;
|
||||||
|
return User.getUsernameById(idapp, userId).then((username) =>
|
||||||
|
{
|
||||||
|
res.send({...ris, username});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
} else {
|
||||||
|
res.status(400).send();
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
console.error('Err', e);
|
||||||
|
res.status(400).send(e);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -872,15 +872,15 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
|||||||
*/
|
*/
|
||||||
} else if (mydata.dbop === 'CorreggiTabHours') {
|
} else if (mydata.dbop === 'CorreggiTabHours') {
|
||||||
|
|
||||||
await Hours.correggiHours(idapp);
|
ris = await Hours.correggiHours(idapp);
|
||||||
|
|
||||||
} else if (mydata.dbop === 'setVerifiedByAportadorToALL') {
|
} else if (mydata.dbop === 'setVerifiedByAportadorToALL') {
|
||||||
|
|
||||||
await User.setVerifiedByAportadorToALL();
|
ris = await User.setVerifiedByAportadorToALL();
|
||||||
|
|
||||||
} else if (mydata.dbop === 'RewriteContribType') {
|
} else if (mydata.dbop === 'RewriteContribType') {
|
||||||
|
|
||||||
populate.rewriteTable('contribtypes');
|
ris = populate.rewriteTable('contribtypes');
|
||||||
|
|
||||||
} else if (mydata.dbop === 'copyFrom1To13') {
|
} else if (mydata.dbop === 'copyFrom1To13') {
|
||||||
const idapporig = 1;
|
const idapporig = 1;
|
||||||
@@ -906,27 +906,50 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
|||||||
numrectot += numrec;
|
numrectot += numrec;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ris = numrectot;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('e', e);
|
console.log('e', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (mydata.dbop === 'emptyTabCatServiziBeni') {
|
||||||
|
|
||||||
|
const {Sector} = require('../models/sector');
|
||||||
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
|
const {Skill} = require('../models/skill');
|
||||||
|
const {Good} = require('../models/good');
|
||||||
|
|
||||||
|
await Sector.deleteMany({});
|
||||||
|
await SectorGood.deleteMany({});
|
||||||
|
await Skill.deleteMany({});
|
||||||
|
ris = await Good.deleteMany({});
|
||||||
|
|
||||||
} else if (mydata.dbop === 'emptyDbSkill') {
|
} else if (mydata.dbop === 'emptyDbSkill') {
|
||||||
|
|
||||||
// Svuota e Ricrea
|
// Svuota e Ricrea
|
||||||
|
|
||||||
const {Sector} = require('../models/sector');
|
const {Sector} = require('../models/sector');
|
||||||
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
const {Skill} = require('../models/skill');
|
const {Skill} = require('../models/skill');
|
||||||
|
const {Good} = require('../models/good');
|
||||||
const {SubSkill} = require('../models/subskill');
|
const {SubSkill} = require('../models/subskill');
|
||||||
const {Contribtype} = require('../models/contribtype');
|
const {Contribtype} = require('../models/contribtype');
|
||||||
const {AdType} = require('../models/adtype');
|
const {AdType} = require('../models/adtype');
|
||||||
|
const {AdTypeGood} = require('../models/adtypegood');
|
||||||
|
const {StatusSkill} = require('../models/statusSkill');
|
||||||
|
|
||||||
await Sector.deleteMany({});
|
await Sector.deleteMany({});
|
||||||
|
await SectorGood.deleteMany({});
|
||||||
await Skill.deleteMany({});
|
await Skill.deleteMany({});
|
||||||
|
await Good.deleteMany({});
|
||||||
await SubSkill.deleteMany({});
|
await SubSkill.deleteMany({});
|
||||||
await Contribtype.deleteMany({});
|
await Contribtype.deleteMany({});
|
||||||
await AdType.deleteMany({});
|
await AdType.deleteMany({});
|
||||||
|
await AdTypeGood.deleteMany({});
|
||||||
|
await StatusSkill.deleteMany({});
|
||||||
|
|
||||||
await populate.popolaTabelleNuove();
|
ris = await populate.popolaTabelleNuove();
|
||||||
|
|
||||||
} else if (mydata.dbop === 'ricreaTabCitiesProvinces') {
|
} else if (mydata.dbop === 'ricreaTabCitiesProvinces') {
|
||||||
|
|
||||||
@@ -938,22 +961,22 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
|||||||
await City.deleteMany({});
|
await City.deleteMany({});
|
||||||
await Province.deleteMany({});
|
await Province.deleteMany({});
|
||||||
|
|
||||||
await populate.popolaTabelleNuove();
|
ris = await populate.popolaTabelleNuove();
|
||||||
|
|
||||||
} else if (mydata.dbop === 'PopulateTables') {
|
} else if (mydata.dbop === 'PopulateTables') {
|
||||||
|
|
||||||
populate.popolaTabelleNuove();
|
ris = populate.popolaTabelleNuove();
|
||||||
|
|
||||||
} else if (mydata.dbop === 'RewriteCitiesTable') {
|
} else if (mydata.dbop === 'RewriteCitiesTable') {
|
||||||
|
|
||||||
populate.rewriteTable('cities');
|
ris = populate.rewriteTable('cities');
|
||||||
} else if (mydata.dbop === 'RewriteLevelTable') {
|
|
||||||
|
|
||||||
populate.rewriteTable('levels');
|
|
||||||
|
|
||||||
} else if (mydata.dbop === 'RewriteLevelsTable') {
|
} else if (mydata.dbop === 'RewriteLevelsTable') {
|
||||||
|
|
||||||
populate.rewriteTable('provinces');
|
ris = populate.rewriteTable('levels');
|
||||||
|
|
||||||
|
} else if (mydata.dbop === 'RewriteProvincesTable') {
|
||||||
|
|
||||||
|
ris = populate.rewriteTable('provinces');
|
||||||
|
|
||||||
} else if (mydata.dbop === 'emptyCityProvinces') {
|
} else if (mydata.dbop === 'emptyCityProvinces') {
|
||||||
|
|
||||||
@@ -1005,9 +1028,17 @@ router.post('/dbop', authenticate, async (req, res) => {
|
|||||||
idapp = req.body.idapp;
|
idapp = req.body.idapp;
|
||||||
locale = req.body.locale;
|
locale = req.body.locale;
|
||||||
|
|
||||||
const ris = await eseguiDbOp(idapp, mydata, locale);
|
try{
|
||||||
|
const ris = await eseguiDbOp(idapp, mydata, locale);
|
||||||
|
|
||||||
res.send(ris);
|
res.send(ris);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
res.status(400).send();
|
||||||
|
res.send({code: server_constants.RIS_CODE_ERR, msg: e});
|
||||||
|
|
||||||
|
console.log(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ myLoad().then(ris => {
|
|||||||
const cart_router = require('./router/cart_router');
|
const cart_router = require('./router/cart_router');
|
||||||
const orders_router = require('./router/orders_router');
|
const orders_router = require('./router/orders_router');
|
||||||
const myskills_router = require('./router/myskills_router');
|
const myskills_router = require('./router/myskills_router');
|
||||||
|
const mygoods_router = require('./router/mygoods_router');
|
||||||
const mygen_router = require('./router/mygen_router');
|
const mygen_router = require('./router/mygen_router');
|
||||||
|
|
||||||
const { MyEvent } = require('./models/myevent');
|
const { MyEvent } = require('./models/myevent');
|
||||||
@@ -159,6 +160,7 @@ myLoad().then(ris => {
|
|||||||
app.use('/cart', cart_router);
|
app.use('/cart', cart_router);
|
||||||
app.use('/orders', orders_router);
|
app.use('/orders', orders_router);
|
||||||
app.use('/myskills', myskills_router);
|
app.use('/myskills', myskills_router);
|
||||||
|
app.use('/mygoods', mygoods_router);
|
||||||
app.use('/mygen', mygen_router);
|
app.use('/mygen', mygen_router);
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
|
|||||||
@@ -130,6 +130,13 @@ MsgBot = {
|
|||||||
'grazie 😘',
|
'grazie 😘',
|
||||||
'grazie😘'],
|
'grazie😘'],
|
||||||
PRINCIPE_AZZURRO: ['principe azzurro'],
|
PRINCIPE_AZZURRO: ['principe azzurro'],
|
||||||
|
COSE_COVID: [
|
||||||
|
'cos\'è il covid',
|
||||||
|
'cosa è il covid',
|
||||||
|
],
|
||||||
|
COVID: [
|
||||||
|
'covid',
|
||||||
|
],
|
||||||
SPOSAMI: [
|
SPOSAMI: [
|
||||||
'sposami',
|
'sposami',
|
||||||
'vuoi sposar',
|
'vuoi sposar',
|
||||||
@@ -158,6 +165,7 @@ MsgBot = {
|
|||||||
'conferenz',
|
'conferenz',
|
||||||
'zoom'],
|
'zoom'],
|
||||||
LAVAGNA: ['lavagna', 'Lavagna', 'LAVAGNA'],
|
LAVAGNA: ['lavagna', 'Lavagna', 'LAVAGNA'],
|
||||||
|
SEI_LIBERO_DI_RESPIRARE: ['sei libero di respirare'],
|
||||||
SEI_LIBERO: ['sei liber', 'sei sposat', 'sei fidanzat', 'sei single'],
|
SEI_LIBERO: ['sei liber', 'sei sposat', 'sei fidanzat', 'sei single'],
|
||||||
AIUTO: [
|
AIUTO: [
|
||||||
'help',
|
'help',
|
||||||
@@ -1544,6 +1552,14 @@ class Telegram {
|
|||||||
} else if (MsgBot.PRINCIPE_AZZURRO.find(
|
} else if (MsgBot.PRINCIPE_AZZURRO.find(
|
||||||
(rec) => testo.indexOf(rec) > -1)) {
|
(rec) => testo.indexOf(rec) > -1)) {
|
||||||
risp = 'Chissà... Forse si!\nAnche se meglio averne un altro di scorta, nel caso il Principe non sia disponibile.';
|
risp = 'Chissà... Forse si!\nAnche se meglio averne un altro di scorta, nel caso il Principe non sia disponibile.';
|
||||||
|
} else if (MsgBot.COSE_COVID.find(
|
||||||
|
(rec) => testo.indexOf(rec) > -1)) {
|
||||||
|
risp = 'Un \'influenza più "grave", dovuta a paure e a fattori interiori di evoluzione, oltre ad una pulizia del corpo. ';
|
||||||
|
} else if (MsgBot.COVID.find(
|
||||||
|
(rec) => testo.indexOf(rec) > -1)) {
|
||||||
|
risp = 'Guarda, è meglio che sorvoliamo questo argomento. Anche un robot capisce che è stato realizzato ' +
|
||||||
|
'il più grande esperimento dell\'Uomo di ipnosi di massa, riempiendo di bugie i media mondiali, che servono sostanzialmente a controllare i popoli.' +
|
||||||
|
'E con questo ti ho detto tutto. :D ';
|
||||||
} else if (MsgBot.AIUTO.find((rec) => testo.indexOf(rec) > -1)) {
|
} else if (MsgBot.AIUTO.find((rec) => testo.indexOf(rec) > -1)) {
|
||||||
risp = 'Clicca qui per entrare nella Chat HELP di Supporto\n' +
|
risp = 'Clicca qui per entrare nella Chat HELP di Supporto\n' +
|
||||||
tools.HELP_CHAT +
|
tools.HELP_CHAT +
|
||||||
@@ -1559,6 +1575,8 @@ class Telegram {
|
|||||||
} else if (MsgBot.SEI_LIBERO.find((rec) => testo.indexOf(rec) > -1)) {
|
} else if (MsgBot.SEI_LIBERO.find((rec) => testo.indexOf(rec) > -1)) {
|
||||||
risp = 'Io? Sono per la Libertà! ' + emo.JOY +
|
risp = 'Io? Sono per la Libertà! ' + emo.JOY +
|
||||||
'\nMa se vuoi possiamo conoscerci meglio!' + emo.DANCER + emo.FIRE;
|
'\nMa se vuoi possiamo conoscerci meglio!' + emo.DANCER + emo.FIRE;
|
||||||
|
} else if (MsgBot.SEI_LIBERO_DI_RESPIRARE.find((rec) => testo.indexOf(rec) > -1)) {
|
||||||
|
risp = 'Assolutamente Sì ! Respirare è fondamentale per l\'essere umano !' + emo.DANCER + emo.FIRE;
|
||||||
} else if (MsgBot.FARE_DOMANDA.find((rec) => testo.indexOf(rec) > -1)) {
|
} else if (MsgBot.FARE_DOMANDA.find((rec) => testo.indexOf(rec) > -1)) {
|
||||||
risp = 'Dipende ' + emo.SMILE_STAR + '\nProvaci!';
|
risp = 'Dipende ' + emo.SMILE_STAR + '\nProvaci!';
|
||||||
} else if (MsgBot.DIVENTERO_RICCA.find(
|
} else if (MsgBot.DIVENTERO_RICCA.find(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const textlang = {
|
|||||||
'partecipanti a Cena Condivisa': 'partecipanti a Cena Condivisa',
|
'partecipanti a Cena Condivisa': 'partecipanti a Cena Condivisa',
|
||||||
'TESTO_ASSISTENZA': '<strong><a href="%s">👉 Per entrare nel Sito</a></strong>\n\n' +
|
'TESTO_ASSISTENZA': '<strong><a href="%s">👉 Per entrare nel Sito</a></strong>\n\n' +
|
||||||
'👉 <strong><a href="https://freeplanet.app/requestresetpwd">Hai dimenticato la password?</a></strong>\n\n',
|
'👉 <strong><a href="https://freeplanet.app/requestresetpwd">Hai dimenticato la password?</a></strong>\n\n',
|
||||||
'BENVENUTO': 'Benvenuto',
|
'BENVENUTO': 'Benvenut@',
|
||||||
'TUE_NAVI': 'Ecco le tue Navi programmate',
|
'TUE_NAVI': 'Ecco le tue Navi programmate',
|
||||||
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi Requisiti per Entrare nella Lista !',
|
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi Requisiti per Entrare nella Lista !',
|
||||||
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare nella Lista !',
|
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare nella Lista !',
|
||||||
|
|||||||
@@ -20,16 +20,20 @@ const {Contribtype} = require('../models/contribtype');
|
|||||||
const {PaymentType} = require('../models/paymenttype');
|
const {PaymentType} = require('../models/paymenttype');
|
||||||
const {Discipline} = require('../models/discipline');
|
const {Discipline} = require('../models/discipline');
|
||||||
const {Skill} = require('../models/skill');
|
const {Skill} = require('../models/skill');
|
||||||
|
const {Good} = require('../models/good');
|
||||||
const {SubSkill} = require('../models/subskill');
|
const {SubSkill} = require('../models/subskill');
|
||||||
const {MySkill} = require('../models/myskill');
|
const {MySkill} = require('../models/myskill');
|
||||||
|
const {MyGood} = require('../models/mygood');
|
||||||
const {MyBacheca} = require('../models/mybacheca');
|
const {MyBacheca} = require('../models/mybacheca');
|
||||||
const {StatusSkill} = require('../models/statusSkill');
|
const {StatusSkill} = require('../models/statusSkill');
|
||||||
const {City} = require('../models/city');
|
const {City} = require('../models/city');
|
||||||
const {Province} = require('../models/province');
|
const {Province} = require('../models/province');
|
||||||
const {Sector} = require('../models/sector');
|
const {Sector} = require('../models/sector');
|
||||||
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
const {CatGrp} = require('../models/catgrp');
|
const {CatGrp} = require('../models/catgrp');
|
||||||
const {Level} = require('../models/level');
|
const {Level} = require('../models/level');
|
||||||
const {AdType} = require('../models/adtype');
|
const {AdType} = require('../models/adtype');
|
||||||
|
const {AdTypeGood} = require('../models/adtypegood');
|
||||||
const Pickup = require('../models/pickup');
|
const Pickup = require('../models/pickup');
|
||||||
const {Newstosent} = require('../models/newstosent');
|
const {Newstosent} = require('../models/newstosent');
|
||||||
const {MyPage} = require('../models/mypage');
|
const {MyPage} = require('../models/mypage');
|
||||||
@@ -155,12 +159,16 @@ module.exports = {
|
|||||||
mytable = Graduatoria;
|
mytable = Graduatoria;
|
||||||
else if (tablename === 'skills')
|
else if (tablename === 'skills')
|
||||||
mytable = Skill;
|
mytable = Skill;
|
||||||
|
else if (tablename === 'goods')
|
||||||
|
mytable = Good;
|
||||||
else if (tablename === 'subskills')
|
else if (tablename === 'subskills')
|
||||||
mytable = SubSkill;
|
mytable = SubSkill;
|
||||||
else if (tablename === shared_consts.TABLES_MYSKILLS)
|
else if (tablename === shared_consts.TABLES_MYSKILLS)
|
||||||
mytable = MySkill;
|
mytable = MySkill;
|
||||||
else if (tablename === shared_consts.TABLES_MYBACHECAS)
|
else if (tablename === shared_consts.TABLES_MYBACHECAS)
|
||||||
mytable = MyBacheca;
|
mytable = MyBacheca;
|
||||||
|
else if (tablename === shared_consts.TABLES_MYGOODS)
|
||||||
|
mytable = MyGood;
|
||||||
else if (tablename === 'statusSkills')
|
else if (tablename === 'statusSkills')
|
||||||
mytable = StatusSkill;
|
mytable = StatusSkill;
|
||||||
else if (tablename === 'cities')
|
else if (tablename === 'cities')
|
||||||
@@ -169,10 +177,16 @@ module.exports = {
|
|||||||
mytable = Province;
|
mytable = Province;
|
||||||
else if (tablename === 'sectors')
|
else if (tablename === 'sectors')
|
||||||
mytable = Sector;
|
mytable = Sector;
|
||||||
|
else if (tablename === 'sectorgoods')
|
||||||
|
mytable = SectorGood;
|
||||||
else if (tablename === 'catgrps')
|
else if (tablename === 'catgrps')
|
||||||
mytable = CatGrp;
|
mytable = CatGrp;
|
||||||
else if (tablename === 'levels')
|
else if (tablename === 'levels')
|
||||||
mytable = Level;
|
mytable = Level;
|
||||||
|
else if (tablename === 'adtypes')
|
||||||
|
mytable = AdType;
|
||||||
|
else if (tablename === 'adtypegoods')
|
||||||
|
mytable = AdTypeGood;
|
||||||
else if (shared_consts.TablePickup.includes(tablename))
|
else if (shared_consts.TablePickup.includes(tablename))
|
||||||
mytable = Pickup;
|
mytable = Pickup;
|
||||||
//else if (shared_consts.TableCities.includes(tablename))
|
//else if (shared_consts.TableCities.includes(tablename))
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ module.exports = {
|
|||||||
FILTER_MEMBERSHIP_CARD_OK: 1048576,
|
FILTER_MEMBERSHIP_CARD_OK: 1048576,
|
||||||
FILTER_USER_NO_VERIFIED_APORTADOR: 2097152,
|
FILTER_USER_NO_VERIFIED_APORTADOR: 2097152,
|
||||||
|
|
||||||
FILTER_MYSKILL_SKILL: 1,
|
|
||||||
|
|
||||||
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
||||||
|
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
||||||
|
OPTIONS_SEARCH_USER_ALL_WORDS: 4,
|
||||||
|
|
||||||
FRIENDSCMD: {
|
FRIENDSCMD: {
|
||||||
SETTRUST: 121,
|
SETTRUST: 121,
|
||||||
@@ -80,29 +80,69 @@ module.exports = {
|
|||||||
'Nessuno',
|
'Nessuno',
|
||||||
'Bonifico Bancario',
|
'Bonifico Bancario',
|
||||||
'Paypal',
|
'Paypal',
|
||||||
'In Contanti alla CNM'
|
'In Contanti alla CNM',
|
||||||
],
|
],
|
||||||
|
|
||||||
PARAM_SHOW_PROVINCE: 1,
|
PARAM_SHOW_PROVINCE: 1,
|
||||||
|
|
||||||
TABLES_MYSKILLS: 'myskills',
|
TABLES_MYSKILLS: 'myskills',
|
||||||
TABLES_MYBACHECAS: 'mybachecas',
|
TABLES_MYBACHECAS: 'mybachecas',
|
||||||
|
TABLES_MYGOODS: 'mygoods',
|
||||||
|
|
||||||
TABLES_ENABLE_GETREC_BYID: ['mybachecas'],
|
TABLES_ENABLE_GETREC_BYID: ['mybachecas'],
|
||||||
|
|
||||||
TABLES_USER_INCLUDE_MY: ['mygroups'],
|
TABLES_USER_INCLUDE_MY: ['mygroups'],
|
||||||
TABLES_GETCOMPLETEREC: ['myskills', 'mybachecas'],
|
TABLES_GETCOMPLETEREC: ['myskills', 'mybachecas', 'mygoods'],
|
||||||
TABLES_PERM_NEWREC: ['skills', 'subskills', 'mygroups'],
|
TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups'],
|
||||||
|
TABLES_REC_ID: ['skills', 'goods', 'subskills'],
|
||||||
|
|
||||||
TABLES_ID_NUMBER: ['permissions', 'levels', 'adtypes', 'statusSkills', 'sectors', 'catgrps', 'skills', 'subskills', 'cities', 'provinces', 'myskills', 'mybachecas', 'mygroups'],
|
TABLES_ID_NUMBER: [
|
||||||
TABLES_USER_ID: ['myskills', 'mybachecas'],
|
'permissions',
|
||||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'mybots'],
|
'levels',
|
||||||
TABLES_FINDER: ['myskills', 'mybachecas', 'mygroups'],
|
'adtypes',
|
||||||
|
'adtypegoods',
|
||||||
|
'statusSkills',
|
||||||
|
'sectors',
|
||||||
|
'sectorgoods',
|
||||||
|
'catgrps',
|
||||||
|
'skills',
|
||||||
|
'subskills',
|
||||||
|
'cities',
|
||||||
|
'provinces',
|
||||||
|
'myskills',
|
||||||
|
'mybachecas',
|
||||||
|
'mygoods',
|
||||||
|
'mygroups'],
|
||||||
|
TABLES_USER_ID: ['myskills', 'mybachecas', 'mygoods'],
|
||||||
|
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'mygoods', 'mybots'],
|
||||||
|
TABLES_FINDER: ['myskills', 'mybachecas', 'mygoods', 'mygroups'],
|
||||||
|
TABLES_VISU_CMYSRECCARD: ['myskills', 'mybachecas', 'mygoods'],
|
||||||
|
|
||||||
TABLES_PERM_CHANGE_FOR_USERS: ['myskills', 'mybachecas'],
|
TABLES_PERM_CHANGE_FOR_USERS: ['myskills', 'mybachecas', 'mygoods'],
|
||||||
TABLES_VISU_LISTA_USER: ['myskills', 'mybachecas', 'users'],
|
TABLES_VISU_LISTA_USER: ['myskills', 'mybachecas', 'mygoods', 'users'],
|
||||||
TABLES_NOT_SHOW_IF_USERNAME: ['myskills', 'mybachecas'],
|
|
||||||
|
|
||||||
|
TABLES_POPULATE_DATA: [
|
||||||
|
{
|
||||||
|
table: 'adtypegoods',
|
||||||
|
key: 'descr',
|
||||||
|
}, {
|
||||||
|
table: 'adtypes',
|
||||||
|
key: 'descr',
|
||||||
|
},
|
||||||
|
{table: 'catgrps', key: 'descr'},
|
||||||
|
{
|
||||||
|
table: 'contribtypes',
|
||||||
|
key: 'descr',
|
||||||
|
},
|
||||||
|
{table: 'goods', key: 'descr'},
|
||||||
|
{table: 'levels', key: 'descr'},
|
||||||
|
{table: 'cities', key: 'comune'},
|
||||||
|
{table: 'provinces', key: 'descr'},
|
||||||
|
{table: 'sectorgoods', key: 'descr'},
|
||||||
|
{table: 'sectors', key: 'descr'},
|
||||||
|
{table: 'skills', key: 'descr'},
|
||||||
|
{table: 'statusSkills', key: 'descr'},
|
||||||
|
],
|
||||||
|
|
||||||
VISIB_ALL: 0,
|
VISIB_ALL: 0,
|
||||||
VISIB_ONLYIF_VERIFIED: 1,
|
VISIB_ONLYIF_VERIFIED: 1,
|
||||||
@@ -144,7 +184,7 @@ module.exports = {
|
|||||||
|
|
||||||
MessageOptions: {
|
MessageOptions: {
|
||||||
Notify_ByEmail: 2,
|
Notify_ByEmail: 2,
|
||||||
Notify_ByPushNotification: 4
|
Notify_ByPushNotification: 4,
|
||||||
},
|
},
|
||||||
|
|
||||||
TypeMsg: {
|
TypeMsg: {
|
||||||
@@ -153,7 +193,7 @@ module.exports = {
|
|||||||
SEND_TO_SOCIO_RESIDENTE: 3,
|
SEND_TO_SOCIO_RESIDENTE: 3,
|
||||||
SEND_TO_CONSIGLIO: 5,
|
SEND_TO_CONSIGLIO: 5,
|
||||||
SEND_TO_NON_SOCI: 10,
|
SEND_TO_NON_SOCI: 10,
|
||||||
SEND_TO_PAOLO: 20
|
SEND_TO_PAOLO: 20,
|
||||||
},
|
},
|
||||||
|
|
||||||
TypeMsg_Actions: {
|
TypeMsg_Actions: {
|
||||||
@@ -170,7 +210,7 @@ module.exports = {
|
|||||||
GET_VALBYTABLE: 400,
|
GET_VALBYTABLE: 400,
|
||||||
SET_VALBYTABLE: 410,
|
SET_VALBYTABLE: 410,
|
||||||
ZOOM_GIA_PARTECIPATO: 510,
|
ZOOM_GIA_PARTECIPATO: 510,
|
||||||
REGISTRATION: 6
|
REGISTRATION: 6,
|
||||||
},
|
},
|
||||||
|
|
||||||
OrderStatus: {
|
OrderStatus: {
|
||||||
@@ -189,12 +229,34 @@ module.exports = {
|
|||||||
ORDER_CONFIRMED: 3,
|
ORDER_CONFIRMED: 3,
|
||||||
PAYED: 4,
|
PAYED: 4,
|
||||||
RECEIVED: 6,
|
RECEIVED: 6,
|
||||||
CANCELED: 10
|
CANCELED: 10,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
fieldsUserToChange() {
|
fieldsUserToChange() {
|
||||||
return ['_id', 'index', 'username', 'group', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'verified_by_aportador', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order', 'old_order', 'numinvitati', 'numinvitatiattivi', 'qualified']
|
return [
|
||||||
}
|
'_id',
|
||||||
|
'index',
|
||||||
|
'username',
|
||||||
|
'group',
|
||||||
|
'email',
|
||||||
|
'name',
|
||||||
|
'surname',
|
||||||
|
'perm',
|
||||||
|
'date_reg',
|
||||||
|
'verified_email',
|
||||||
|
'verified_by_aportador',
|
||||||
|
'ipaddr',
|
||||||
|
'lasttimeonline',
|
||||||
|
'profile',
|
||||||
|
'calcstat',
|
||||||
|
'news_on',
|
||||||
|
'aportador_solidario',
|
||||||
|
'made_gift',
|
||||||
|
'ind_order',
|
||||||
|
'old_order',
|
||||||
|
'numinvitati',
|
||||||
|
'numinvitatiattivi',
|
||||||
|
'qualified'];
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user