- CMyPopupEdit
- CMyEditor - MySkills
This commit is contained in:
@@ -96,6 +96,12 @@ CitySchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, 0, params);
|
||||
};
|
||||
|
||||
CitySchema.statics.findAllIdApp = async function (idapp) {
|
||||
const myfind = {};
|
||||
|
||||
return City.find(myfind);
|
||||
};
|
||||
|
||||
|
||||
const City = mongoose.model('City', CitySchema);
|
||||
|
||||
|
||||
@@ -21,19 +21,42 @@ const MySkillSchema = new Schema({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
||||
idSkill: {
|
||||
type: Number,
|
||||
},
|
||||
idStatusSkill: [{
|
||||
type: Number,
|
||||
}],
|
||||
idStatusSkill: [
|
||||
{
|
||||
type: Number,
|
||||
}],
|
||||
idCity: [
|
||||
{
|
||||
type: Number,
|
||||
}],
|
||||
numLevel: {
|
||||
type: Number,
|
||||
},
|
||||
photos: [
|
||||
{
|
||||
imagefile: {
|
||||
type: String,
|
||||
},
|
||||
order: {
|
||||
type: Number,
|
||||
},
|
||||
alt: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
}],
|
||||
note: {
|
||||
type: String,
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
},
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
@@ -44,9 +67,9 @@ const MySkillSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
MySkillSchema.pre('save', async function (next) {
|
||||
MySkillSchema.pre('save', async function(next) {
|
||||
if (this.isNew) {
|
||||
const myrec = await MySkill.findOne().limit(1).sort({_id:-1});
|
||||
const myrec = await MySkill.findOne().limit(1).sort({_id: -1});
|
||||
if (!!myrec) {
|
||||
if (myrec._doc._id === 0)
|
||||
this._id = 1;
|
||||
@@ -63,11 +86,10 @@ MySkillSchema.pre('save', async function (next) {
|
||||
next();
|
||||
});
|
||||
|
||||
|
||||
MySkillSchema.statics.findAllIdApp = function(idapp) {
|
||||
|
||||
const query = [
|
||||
{ $match: { idapp } },
|
||||
{$match: {idapp}},
|
||||
{$sort: {descr: 1}},
|
||||
];
|
||||
|
||||
@@ -78,7 +100,7 @@ MySkillSchema.statics.findAllIdApp = function(idapp) {
|
||||
};
|
||||
|
||||
MySkillSchema.statics.getFieldsForSearch = function() {
|
||||
return [{ field: 'idSkill', type: tools.FieldType.Number }]
|
||||
return [{field: 'idSkill', type: tools.FieldType.Number}];
|
||||
};
|
||||
|
||||
MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
|
||||
@@ -253,6 +253,9 @@ const UserSchema = new mongoose.Schema({
|
||||
sex: {
|
||||
type: Number,
|
||||
},
|
||||
biografia: {
|
||||
type: String,
|
||||
},
|
||||
motivazioni: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user