- Codice internazionale numero + Country
This commit is contained in:
@@ -7,7 +7,6 @@ const _ = require('lodash');
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const queryclass = require('../classes/queryclass');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ const { Nave } = require('./nave');
|
||||
const { Settings } = require('./settings');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const queryclass = require('../classes/queryclass');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ const { Graduatoria } = require('./graduatoria');
|
||||
const actions = require('../router/api/actions');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const queryclass = require('../classes/queryclass');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
|
||||
@@ -30,6 +30,10 @@ const MySkillSchema = new Schema({
|
||||
{
|
||||
type: Number,
|
||||
}],
|
||||
idContribType: [
|
||||
{
|
||||
type: String,
|
||||
}],
|
||||
idCity: [
|
||||
{
|
||||
type: Number,
|
||||
@@ -109,25 +113,28 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
|
||||
const otherparams = {
|
||||
lk_tab: 'users',
|
||||
lk_LF: 'userId',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: {
|
||||
idSkill: 1,
|
||||
idStatusSkill: 1,
|
||||
idCity: 1,
|
||||
numLevel: 1,
|
||||
photos: 1,
|
||||
note: 1,
|
||||
subTitle: 1,
|
||||
date_created: 1,
|
||||
date_updated: 1,
|
||||
userId: 1,
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lookup1: {
|
||||
lk_tab: 'users',
|
||||
lk_LF: 'userId',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: {
|
||||
idSkill: 1,
|
||||
idStatusSkill: 1,
|
||||
idContribType: 1,
|
||||
idCity: 1,
|
||||
numLevel: 1,
|
||||
photos: 1,
|
||||
note: 1,
|
||||
subTitle: 1,
|
||||
date_created: 1,
|
||||
date_updated: 1,
|
||||
userId: 1,
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
58
src/server/models/pickup.js
Executable file
58
src/server/models/pickup.js
Executable file
@@ -0,0 +1,58 @@
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const countryCodes = require('country-codes-list');
|
||||
|
||||
module.exports = {
|
||||
|
||||
async executeQueryTable(idapp, params) {
|
||||
|
||||
const table = params.table;
|
||||
const strfind = params.search;
|
||||
|
||||
if (strfind === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
let myCountryArr = [];
|
||||
|
||||
let out = {};
|
||||
|
||||
if (table === shared_consts.TAB_COUNTRY) {
|
||||
// '[{countryCode}] {countryNameLocal}: +{countryCallingCode}'
|
||||
out = {
|
||||
id: '{countryCode}',
|
||||
value: '{countryNameLocal}',
|
||||
flag: '{flag}',
|
||||
};
|
||||
|
||||
} else if (table === shared_consts.TAB_PHONES) {
|
||||
out = {
|
||||
id: '{countryCode}',
|
||||
value: '{countryNameLocal} +{countryCallingCode}',
|
||||
code: '+{countryCallingCode}',
|
||||
flag: '{flag}',
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
// const myCountryArr = countryCodes.filter('countryNameLocal', strfind);
|
||||
// const myCountryArr = countryCodes.customList.filter()
|
||||
|
||||
// myCountryArr = countryCodes.customList('countryCode', lavueout, { filter: ((countryData) => { return countryData['countryNameLocal'].toLocaleLowerCase().indexOf(strfind) >= 0 })} );
|
||||
myCountryArr = countryCodes.customArray(out, {
|
||||
filter: ((countryData) => {
|
||||
return countryData['countryNameLocal'].toLocaleLowerCase().
|
||||
startsWith(strfind) || countryData['countryNameEn'].toLocaleLowerCase().
|
||||
startsWith(strfind);
|
||||
}),
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.log('err', e);
|
||||
}
|
||||
|
||||
return myCountryArr;
|
||||
},
|
||||
};
|
||||
@@ -56,6 +56,24 @@ const SiteSchema = new Schema({
|
||||
pathreg_add: {
|
||||
type: String,
|
||||
},
|
||||
who: {
|
||||
type: String
|
||||
},
|
||||
status: {
|
||||
type: String
|
||||
},
|
||||
note: {
|
||||
type: String
|
||||
},
|
||||
domain_provider: {
|
||||
type: String,
|
||||
},
|
||||
domain_expiring: {
|
||||
type: Date
|
||||
},
|
||||
next_payment: {
|
||||
type: Date
|
||||
},
|
||||
});
|
||||
|
||||
var Site = module.exports = mongoose.model('Site', SiteSchema);
|
||||
|
||||
@@ -17,7 +17,6 @@ const {NavePersistente} = require('../models/navepersistente');
|
||||
const {ObjectID} = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const queryclass = require('../classes/queryclass');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
@@ -229,6 +228,18 @@ const UserSchema = new mongoose.Schema({
|
||||
dateofbirth: {
|
||||
type: Date,
|
||||
},
|
||||
born_city: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
born_province: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
born_country: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
my_dream: {
|
||||
type: String,
|
||||
},
|
||||
@@ -1504,32 +1515,6 @@ UserSchema.statics.getUsersList = function(idapp) {
|
||||
);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersListByParams = function(params) {
|
||||
const User = this;
|
||||
|
||||
myclParamQuery = new queryclass.CParamsQuery(params);
|
||||
|
||||
const filterMatchBefore = `${myclParamQuery.filter}`;
|
||||
|
||||
return User.find(
|
||||
{$match: filterMatchBefore},
|
||||
{'idapp': idapp},
|
||||
{
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
verified_email: 1,
|
||||
made_gift: 1,
|
||||
perm: 1,
|
||||
email: 1,
|
||||
date_reg: 1,
|
||||
img: 1,
|
||||
lasttimeonline: 1,
|
||||
news_on: 1,
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Query blog posts by user -> paginated results and a total count.
|
||||
* @returns {Object} Object -> `{ rows, count }`
|
||||
|
||||
Reference in New Issue
Block a user