- aggiunto anche nei beni, servizi e ospitalità la possibilità di aggiungerli come "Gruppo"
This commit is contained in:
@@ -13,6 +13,8 @@ const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_MYSKILLS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true;
|
||||
@@ -32,6 +34,7 @@ const MySkillSchema = new Schema(
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
groupname: { type: String },
|
||||
idSector: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -152,7 +155,7 @@ MySkillSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -206,7 +209,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -232,7 +235,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -258,7 +261,21 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$lookup: {
|
||||
'from': 'mygroups',
|
||||
'localField': 'groupname',
|
||||
'foreignField': 'groupname',
|
||||
'as': 'mygrp',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$mygrp',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
/*{
|
||||
'$lookup': {
|
||||
@@ -286,7 +303,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -319,7 +336,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
Reference in New Issue
Block a user