- CMyPopupEdit

- CMyEditor
 - MySkills
This commit is contained in:
Paolo Arena
2021-10-28 00:38:10 +02:00
parent 300ab15ca7
commit ad7fc67d43
8 changed files with 126 additions and 48 deletions

View File

@@ -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) {