@blackcode_sa/metaestetics-api 1.7.21 → 1.7.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/admin/index.js
CHANGED
|
@@ -4468,32 +4468,21 @@ var FilledFormsAggregationService = class {
|
|
|
4468
4468
|
);
|
|
4469
4469
|
}
|
|
4470
4470
|
let updateData = {};
|
|
4471
|
-
let
|
|
4471
|
+
let updatedLinkedForms = [];
|
|
4472
4472
|
if (appointment.linkedForms && appointment.linkedForms.length > 0) {
|
|
4473
|
-
|
|
4474
|
-
(form) => form.formId
|
|
4473
|
+
updatedLinkedForms = appointment.linkedForms.filter(
|
|
4474
|
+
(form) => form.formId !== filledDocument.id
|
|
4475
4475
|
);
|
|
4476
4476
|
}
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
updateData =
|
|
4486
|
-
linkedForms: admin11.firestore.FieldValue.arrayUnion(linkedFormInfo),
|
|
4487
|
-
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4488
|
-
};
|
|
4489
|
-
} else {
|
|
4490
|
-
updateData = {
|
|
4491
|
-
linkedForms: appointment.linkedForms ? admin11.firestore.FieldValue.arrayUnion(linkedFormInfo) : [linkedFormInfo],
|
|
4492
|
-
// If linkedForms doesn't exist, create a new array
|
|
4493
|
-
linkedFormIds: appointment.linkedFormIds ? admin11.firestore.FieldValue.arrayUnion(filledDocument.id) : [filledDocument.id],
|
|
4494
|
-
// If linkedFormIds doesn't exist, create a new array
|
|
4495
|
-
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4496
|
-
};
|
|
4477
|
+
updatedLinkedForms.push(linkedFormInfo);
|
|
4478
|
+
updateData = {
|
|
4479
|
+
linkedForms: updatedLinkedForms,
|
|
4480
|
+
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4481
|
+
};
|
|
4482
|
+
let updatedLinkedFormIds = appointment.linkedFormIds || [];
|
|
4483
|
+
if (!updatedLinkedFormIds.includes(filledDocument.id)) {
|
|
4484
|
+
updatedLinkedFormIds.push(filledDocument.id);
|
|
4485
|
+
updateData.linkedFormIds = updatedLinkedFormIds;
|
|
4497
4486
|
}
|
|
4498
4487
|
if (filledDocument.isUserForm && filledDocument.isRequired && (filledDocument.status === "completed" /* COMPLETED */ || filledDocument.status === "signed" /* SIGNED */)) {
|
|
4499
4488
|
if (appointment.pendingUserFormsIds && appointment.pendingUserFormsIds.includes(filledDocument.id)) {
|
package/dist/admin/index.mjs
CHANGED
|
@@ -4411,32 +4411,21 @@ var FilledFormsAggregationService = class {
|
|
|
4411
4411
|
);
|
|
4412
4412
|
}
|
|
4413
4413
|
let updateData = {};
|
|
4414
|
-
let
|
|
4414
|
+
let updatedLinkedForms = [];
|
|
4415
4415
|
if (appointment.linkedForms && appointment.linkedForms.length > 0) {
|
|
4416
|
-
|
|
4417
|
-
(form) => form.formId
|
|
4416
|
+
updatedLinkedForms = appointment.linkedForms.filter(
|
|
4417
|
+
(form) => form.formId !== filledDocument.id
|
|
4418
4418
|
);
|
|
4419
4419
|
}
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
updateData =
|
|
4429
|
-
linkedForms: admin11.firestore.FieldValue.arrayUnion(linkedFormInfo),
|
|
4430
|
-
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4431
|
-
};
|
|
4432
|
-
} else {
|
|
4433
|
-
updateData = {
|
|
4434
|
-
linkedForms: appointment.linkedForms ? admin11.firestore.FieldValue.arrayUnion(linkedFormInfo) : [linkedFormInfo],
|
|
4435
|
-
// If linkedForms doesn't exist, create a new array
|
|
4436
|
-
linkedFormIds: appointment.linkedFormIds ? admin11.firestore.FieldValue.arrayUnion(filledDocument.id) : [filledDocument.id],
|
|
4437
|
-
// If linkedFormIds doesn't exist, create a new array
|
|
4438
|
-
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4439
|
-
};
|
|
4420
|
+
updatedLinkedForms.push(linkedFormInfo);
|
|
4421
|
+
updateData = {
|
|
4422
|
+
linkedForms: updatedLinkedForms,
|
|
4423
|
+
updatedAt: admin11.firestore.FieldValue.serverTimestamp()
|
|
4424
|
+
};
|
|
4425
|
+
let updatedLinkedFormIds = appointment.linkedFormIds || [];
|
|
4426
|
+
if (!updatedLinkedFormIds.includes(filledDocument.id)) {
|
|
4427
|
+
updatedLinkedFormIds.push(filledDocument.id);
|
|
4428
|
+
updateData.linkedFormIds = updatedLinkedFormIds;
|
|
4440
4429
|
}
|
|
4441
4430
|
if (filledDocument.isUserForm && filledDocument.isRequired && (filledDocument.status === "completed" /* COMPLETED */ || filledDocument.status === "signed" /* SIGNED */)) {
|
|
4442
4431
|
if (appointment.pendingUserFormsIds && appointment.pendingUserFormsIds.includes(filledDocument.id)) {
|
package/package.json
CHANGED
|
@@ -94,45 +94,31 @@ export class FilledFormsAggregationService {
|
|
|
94
94
|
) as unknown as Timestamp;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// 3.
|
|
97
|
+
// 3. Handle linkedForms array - use direct array manipulation to avoid arrayRemove issues
|
|
98
98
|
let updateData: any = {};
|
|
99
|
-
let
|
|
99
|
+
let updatedLinkedForms: LinkedFormInfo[] = [];
|
|
100
100
|
|
|
101
101
|
if (appointment.linkedForms && appointment.linkedForms.length > 0) {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
// Filter out any existing entries for this form ID to prevent duplicates
|
|
103
|
+
updatedLinkedForms = appointment.linkedForms.filter(
|
|
104
|
+
(form) => form.formId !== filledDocument.id
|
|
104
105
|
);
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
// Form exists, update it using arrayRemove + arrayUnion
|
|
110
|
-
updateData = {
|
|
111
|
-
linkedForms: admin.firestore.FieldValue.arrayRemove(
|
|
112
|
-
appointment.linkedForms[existingFormIndex]
|
|
113
|
-
),
|
|
114
|
-
updatedAt: admin.firestore.FieldValue.serverTimestamp(),
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// First remove the old form info
|
|
118
|
-
await appointmentRef.update(updateData);
|
|
108
|
+
// Add the new/updated form info
|
|
109
|
+
updatedLinkedForms.push(linkedFormInfo);
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
linkedFormIds: appointment.linkedFormIds
|
|
132
|
-
? admin.firestore.FieldValue.arrayUnion(filledDocument.id)
|
|
133
|
-
: [filledDocument.id], // If linkedFormIds doesn't exist, create a new array
|
|
134
|
-
updatedAt: admin.firestore.FieldValue.serverTimestamp(),
|
|
135
|
-
};
|
|
111
|
+
// Prepare the update data
|
|
112
|
+
updateData = {
|
|
113
|
+
linkedForms: updatedLinkedForms,
|
|
114
|
+
updatedAt: admin.firestore.FieldValue.serverTimestamp(),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// 4. Handle linkedFormIds array
|
|
118
|
+
let updatedLinkedFormIds: string[] = appointment.linkedFormIds || [];
|
|
119
|
+
if (!updatedLinkedFormIds.includes(filledDocument.id)) {
|
|
120
|
+
updatedLinkedFormIds.push(filledDocument.id);
|
|
121
|
+
updateData.linkedFormIds = updatedLinkedFormIds;
|
|
136
122
|
}
|
|
137
123
|
|
|
138
124
|
// 5. Handle pendingUserFormsIds for required user forms
|