Grosse Modifiche Completate !

This commit is contained in:
Paolo Arena
2020-05-11 22:43:14 +02:00
parent 9c7cf28a4a
commit c6acadb3e6
10 changed files with 269 additions and 229 deletions

View File

@@ -125,13 +125,13 @@ function getQueryProj(myfilter) {
}
},
{
$unwind: "$mylista"
$replaceRoot: { newRoot: { $mergeObjects: [ { $arrayElemAt: [ "$mylista", 0 ] }, "$$ROOT" ] } }
},
{
$lookup: {
from: "users",
as: "user",
let: {username: '$mylista.username' },
let: {username: '$username' },
pipeline: [
{
$match: {
@@ -196,6 +196,7 @@ NavePersistenteSchema.statics.getListaNavi = function (idapp) {
col: 1,
riga1don: 1,
col1don: 1,
date_gift_chat_open: 1,
date_start: 1,
provvisoria: 1,
DoniConfermati: 1,
@@ -252,6 +253,10 @@ NavePersistenteSchema.statics.getLastRigaCol = async function (idapp) {
return NavePersistente.findOne({ idapp }).sort({ _id: -1 });
};
NavePersistenteSchema.statics.getLastRigaColDefinitiva = async function (idapp) {
return NavePersistente.findOne({ idapp, provvisoria: false }).sort({ riga: -1, col: -1 });
};
NavePersistenteSchema.pre('save', async function (next) {
if (this.isNew) {
const myrec = await NavePersistente.findOne().limit(1).sort({ _id: -1 });