- select specializz.
This commit is contained in:
@@ -26,6 +26,11 @@ const MySkillSchema = new Schema({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
|
idSubSkill: [
|
||||||
|
{
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
}],
|
||||||
idStatusSkill: [
|
idStatusSkill: [
|
||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
81
src/server/models/subskill.js
Executable file
81
src/server/models/subskill.js
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
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 SubSkillSchema = new Schema({
|
||||||
|
_id: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
idSkill: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
descr: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
img: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
SubSkillSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
|
const SubSkill = this;
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{ $sort: { descr: 1 } }
|
||||||
|
];
|
||||||
|
|
||||||
|
return SubSkill
|
||||||
|
.aggregate(query)
|
||||||
|
.then((arrrec) => {
|
||||||
|
return arrrec
|
||||||
|
})
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
SubSkillSchema.pre('save', async function (next) {
|
||||||
|
if (this.isNew) {
|
||||||
|
const myrec = await SubSkill.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();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SubSkillSchema.statics.getFieldsForSearch = function () {
|
||||||
|
return [{ field: 'label', type: tools.FieldType.string },
|
||||||
|
{ field: 'descr', type: tools.FieldType.string }]
|
||||||
|
};
|
||||||
|
|
||||||
|
SubSkillSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
return tools.executeQueryTable(this, 0, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const SubSkill = mongoose.model('SubSkill', SubSkillSchema);
|
||||||
|
|
||||||
|
module.exports = { SubSkill };
|
||||||
@@ -44,6 +44,7 @@ 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 {SubSkill} = require('../models/subskill');
|
||||||
const {MySkill} = require('../models/myskill');
|
const {MySkill} = require('../models/myskill');
|
||||||
const {StatusSkill} = require('../models/statusSkill');
|
const {StatusSkill} = require('../models/statusSkill');
|
||||||
const {City} = require('../models/city');
|
const {City} = require('../models/city');
|
||||||
@@ -304,6 +305,8 @@ function getTableByTableName(tablename) {
|
|||||||
mytable = Graduatoria;
|
mytable = Graduatoria;
|
||||||
else if (tablename === 'skills')
|
else if (tablename === 'skills')
|
||||||
mytable = Skill;
|
mytable = Skill;
|
||||||
|
else if (tablename === 'subskills')
|
||||||
|
mytable = SubSkill;
|
||||||
else if (tablename === 'myskills')
|
else if (tablename === 'myskills')
|
||||||
mytable = MySkill;
|
mytable = MySkill;
|
||||||
else if (tablename === 'statusSkills')
|
else if (tablename === 'statusSkills')
|
||||||
@@ -1300,6 +1303,7 @@ function load(req, res, version) {
|
|||||||
// SKILLS:
|
// SKILLS:
|
||||||
let levels = Level.findAllIdApp(idapp);
|
let levels = Level.findAllIdApp(idapp);
|
||||||
let skills = Skill.findAllIdApp(idapp);
|
let skills = Skill.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 cities = City.findAllIdApp(idapp);
|
let cities = City.findAllIdApp(idapp);
|
||||||
@@ -1348,6 +1352,7 @@ function load(req, res, version) {
|
|||||||
internalpages,
|
internalpages,
|
||||||
levels,
|
levels,
|
||||||
skills,
|
skills,
|
||||||
|
subSkills,
|
||||||
sectors,
|
sectors,
|
||||||
statusSkills,
|
statusSkills,
|
||||||
cities]).then((arrdata) => {
|
cities]).then((arrdata) => {
|
||||||
@@ -1412,9 +1417,10 @@ function load(req, res, version) {
|
|||||||
internalpages: arrdata[23],
|
internalpages: arrdata[23],
|
||||||
levels: arrdata[24],
|
levels: arrdata[24],
|
||||||
skills: arrdata[25],
|
skills: arrdata[25],
|
||||||
sectors: arrdata[26],
|
subSkills: arrdata[26],
|
||||||
statusSkills: arrdata[27],
|
sectors: arrdata[27],
|
||||||
cities: arrdata[28],
|
statusSkills: arrdata[28],
|
||||||
|
cities: arrdata[29],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1261,6 +1261,9 @@ module.exports = {
|
|||||||
const q3 = this.getLookup(params.lookup3, 3, proj);
|
const q3 = this.getLookup(params.lookup3, 3, proj);
|
||||||
if (q3) query = [...query, ...q3];
|
if (q3) query = [...query, ...q3];
|
||||||
|
|
||||||
|
const q4 = this.getLookup(params.lookup4, 4, proj);
|
||||||
|
if (q4) query = [...query, ...q4];
|
||||||
|
|
||||||
if (params.filtersearch2.length > 0) {
|
if (params.filtersearch2.length > 0) {
|
||||||
query.push({$match: {$and: params.filtersearch2}});
|
query.push({$match: {$and: params.filtersearch2}});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ module.exports = {
|
|||||||
'In Contanti alla CNM'
|
'In Contanti alla CNM'
|
||||||
],
|
],
|
||||||
|
|
||||||
TABLES_ID_NUMBER: ['permissions', 'levels', 'statusSkills', 'sectors', 'skills', 'cities', 'myskills'],
|
TABLES_ID_NUMBER: ['permissions', 'levels', 'statusSkills', 'sectors', 'skills', 'subskills', 'cities', 'myskills'],
|
||||||
TABLES_USER_ID: ['myskills'],
|
TABLES_USER_ID: ['myskills'],
|
||||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybots'],
|
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybots'],
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user