@blackcode_sa/metaestetics-api 1.14.53 → 1.14.56
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.d.mts +2 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -15
- package/dist/index.mjs +38 -15
- package/package.json +1 -1
- package/src/services/appointment/utils/extended-procedure.utils.ts +55 -17
- package/src/types/appointment/index.ts +3 -1
package/dist/admin/index.d.mts
CHANGED
|
@@ -1714,6 +1714,7 @@ interface ZoneItemData {
|
|
|
1714
1714
|
notesVisibleToPatient?: boolean;
|
|
1715
1715
|
subtotal?: number;
|
|
1716
1716
|
ionNumber?: string;
|
|
1717
|
+
expiryDate?: string;
|
|
1717
1718
|
createdAt?: string;
|
|
1718
1719
|
updatedAt?: string;
|
|
1719
1720
|
}
|
|
@@ -1765,6 +1766,7 @@ interface AppointmentProductMetadata {
|
|
|
1765
1766
|
interface ExtendedProcedureInfo {
|
|
1766
1767
|
procedureId: string;
|
|
1767
1768
|
procedureName: string;
|
|
1769
|
+
procedureDescription?: string;
|
|
1768
1770
|
procedureFamily?: ProcedureFamily;
|
|
1769
1771
|
procedureCategoryId: string;
|
|
1770
1772
|
procedureCategoryName: string;
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1714,6 +1714,7 @@ interface ZoneItemData {
|
|
|
1714
1714
|
notesVisibleToPatient?: boolean;
|
|
1715
1715
|
subtotal?: number;
|
|
1716
1716
|
ionNumber?: string;
|
|
1717
|
+
expiryDate?: string;
|
|
1717
1718
|
createdAt?: string;
|
|
1718
1719
|
updatedAt?: string;
|
|
1719
1720
|
}
|
|
@@ -1765,6 +1766,7 @@ interface AppointmentProductMetadata {
|
|
|
1765
1766
|
interface ExtendedProcedureInfo {
|
|
1766
1767
|
procedureId: string;
|
|
1767
1768
|
procedureName: string;
|
|
1769
|
+
procedureDescription?: string;
|
|
1768
1770
|
procedureFamily?: ProcedureFamily;
|
|
1769
1771
|
procedureCategoryId: string;
|
|
1770
1772
|
procedureCategoryName: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -5651,6 +5651,7 @@ interface ZoneItemData {
|
|
|
5651
5651
|
notesVisibleToPatient?: boolean;
|
|
5652
5652
|
subtotal?: number;
|
|
5653
5653
|
ionNumber?: string;
|
|
5654
|
+
expiryDate?: string;
|
|
5654
5655
|
createdAt?: string;
|
|
5655
5656
|
updatedAt?: string;
|
|
5656
5657
|
}
|
|
@@ -5702,6 +5703,7 @@ interface AppointmentProductMetadata {
|
|
|
5702
5703
|
interface ExtendedProcedureInfo {
|
|
5703
5704
|
procedureId: string;
|
|
5704
5705
|
procedureName: string;
|
|
5706
|
+
procedureDescription?: string;
|
|
5705
5707
|
procedureFamily?: ProcedureFamily;
|
|
5706
5708
|
procedureCategoryId: string;
|
|
5707
5709
|
procedureCategoryName: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -5651,6 +5651,7 @@ interface ZoneItemData {
|
|
|
5651
5651
|
notesVisibleToPatient?: boolean;
|
|
5652
5652
|
subtotal?: number;
|
|
5653
5653
|
ionNumber?: string;
|
|
5654
|
+
expiryDate?: string;
|
|
5654
5655
|
createdAt?: string;
|
|
5655
5656
|
updatedAt?: string;
|
|
5656
5657
|
}
|
|
@@ -5702,6 +5703,7 @@ interface AppointmentProductMetadata {
|
|
|
5702
5703
|
interface ExtendedProcedureInfo {
|
|
5703
5704
|
procedureId: string;
|
|
5704
5705
|
procedureName: string;
|
|
5706
|
+
procedureDescription?: string;
|
|
5705
5707
|
procedureFamily?: ProcedureFamily;
|
|
5706
5708
|
procedureCategoryId: string;
|
|
5707
5709
|
procedureCategoryName: string;
|
package/dist/index.js
CHANGED
|
@@ -5310,6 +5310,7 @@ async function createExtendedProcedureInfo(db, procedureId) {
|
|
|
5310
5310
|
return {
|
|
5311
5311
|
procedureId,
|
|
5312
5312
|
procedureName: data.name,
|
|
5313
|
+
procedureDescription: data.description || "",
|
|
5313
5314
|
procedureFamily: data.family,
|
|
5314
5315
|
// Use embedded family object
|
|
5315
5316
|
procedureCategoryId: data.category.id,
|
|
@@ -5369,12 +5370,19 @@ async function addExtendedProcedureUtil(db, appointmentId, procedureId) {
|
|
|
5369
5370
|
appointment.practitionerId,
|
|
5370
5371
|
appointment.clinicBranchId
|
|
5371
5372
|
);
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5373
|
+
const existingFormIds = new Set(updatedLinkedFormIds);
|
|
5374
|
+
const newFormIds = formInitResult.allLinkedFormIds.filter((id) => !existingFormIds.has(id));
|
|
5375
|
+
updatedLinkedFormIds = [...updatedLinkedFormIds, ...newFormIds];
|
|
5376
|
+
const existingFormIdsInLinkedForms = new Set(updatedLinkedForms.map((f) => f.formId));
|
|
5377
|
+
const newLinkedForms = formInitResult.initializedFormsInfo.filter(
|
|
5378
|
+
(form) => !existingFormIdsInLinkedForms.has(form.formId)
|
|
5379
|
+
);
|
|
5380
|
+
updatedLinkedForms = [...updatedLinkedForms, ...newLinkedForms];
|
|
5381
|
+
const existingPendingIds = new Set(updatedPendingUserFormsIds);
|
|
5382
|
+
const newPendingIds = formInitResult.pendingUserFormsIds.filter(
|
|
5383
|
+
(id) => !existingPendingIds.has(id)
|
|
5384
|
+
);
|
|
5385
|
+
updatedPendingUserFormsIds = [...updatedPendingUserFormsIds, ...newPendingIds];
|
|
5378
5386
|
}
|
|
5379
5387
|
const extendedProcedures = [...metadata.extendedProcedures || [], extendedProcedureInfo];
|
|
5380
5388
|
const appointmentRef = (0, import_firestore10.doc)(db, APPOINTMENTS_COLLECTION, appointmentId);
|
|
@@ -5417,15 +5425,30 @@ async function removeExtendedProcedureUtil(db, appointmentId, procedureId) {
|
|
|
5417
5425
|
`\u{1F5D1}\uFE0F [removeExtendedProcedure] Removed ${productsRemovedFromZones} products from zones for procedure ${procedureId}`
|
|
5418
5426
|
);
|
|
5419
5427
|
const removedFormIds = await removeFormsForExtendedProcedure(db, appointmentId, procedureId);
|
|
5420
|
-
const
|
|
5421
|
-
|
|
5422
|
-
)
|
|
5423
|
-
|
|
5424
|
-
(
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
);
|
|
5428
|
+
const removedFormIdsSet = new Set(removedFormIds);
|
|
5429
|
+
const linkedFormIdsSet = /* @__PURE__ */ new Set();
|
|
5430
|
+
const updatedLinkedFormIds = (appointment.linkedFormIds || []).filter((formId) => {
|
|
5431
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
5432
|
+
if (linkedFormIdsSet.has(formId)) return false;
|
|
5433
|
+
linkedFormIdsSet.add(formId);
|
|
5434
|
+
return true;
|
|
5435
|
+
});
|
|
5436
|
+
const linkedFormsMap = /* @__PURE__ */ new Map();
|
|
5437
|
+
(appointment.linkedForms || []).forEach((form) => {
|
|
5438
|
+
if (!removedFormIdsSet.has(form.formId)) {
|
|
5439
|
+
if (!linkedFormsMap.has(form.formId)) {
|
|
5440
|
+
linkedFormsMap.set(form.formId, form);
|
|
5441
|
+
}
|
|
5442
|
+
}
|
|
5443
|
+
});
|
|
5444
|
+
const updatedLinkedForms = Array.from(linkedFormsMap.values());
|
|
5445
|
+
const pendingIdsSet = /* @__PURE__ */ new Set();
|
|
5446
|
+
const updatedPendingUserFormsIds = (appointment.pendingUserFormsIds || []).filter((formId) => {
|
|
5447
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
5448
|
+
if (pendingIdsSet.has(formId)) return false;
|
|
5449
|
+
pendingIdsSet.add(formId);
|
|
5450
|
+
return true;
|
|
5451
|
+
});
|
|
5429
5452
|
const appointmentRef = (0, import_firestore10.doc)(db, APPOINTMENTS_COLLECTION, appointmentId);
|
|
5430
5453
|
await (0, import_firestore10.updateDoc)(appointmentRef, {
|
|
5431
5454
|
"metadata.extendedProcedures": metadata.extendedProcedures,
|
package/dist/index.mjs
CHANGED
|
@@ -5196,6 +5196,7 @@ async function createExtendedProcedureInfo(db, procedureId) {
|
|
|
5196
5196
|
return {
|
|
5197
5197
|
procedureId,
|
|
5198
5198
|
procedureName: data.name,
|
|
5199
|
+
procedureDescription: data.description || "",
|
|
5199
5200
|
procedureFamily: data.family,
|
|
5200
5201
|
// Use embedded family object
|
|
5201
5202
|
procedureCategoryId: data.category.id,
|
|
@@ -5255,12 +5256,19 @@ async function addExtendedProcedureUtil(db, appointmentId, procedureId) {
|
|
|
5255
5256
|
appointment.practitionerId,
|
|
5256
5257
|
appointment.clinicBranchId
|
|
5257
5258
|
);
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5259
|
+
const existingFormIds = new Set(updatedLinkedFormIds);
|
|
5260
|
+
const newFormIds = formInitResult.allLinkedFormIds.filter((id) => !existingFormIds.has(id));
|
|
5261
|
+
updatedLinkedFormIds = [...updatedLinkedFormIds, ...newFormIds];
|
|
5262
|
+
const existingFormIdsInLinkedForms = new Set(updatedLinkedForms.map((f) => f.formId));
|
|
5263
|
+
const newLinkedForms = formInitResult.initializedFormsInfo.filter(
|
|
5264
|
+
(form) => !existingFormIdsInLinkedForms.has(form.formId)
|
|
5265
|
+
);
|
|
5266
|
+
updatedLinkedForms = [...updatedLinkedForms, ...newLinkedForms];
|
|
5267
|
+
const existingPendingIds = new Set(updatedPendingUserFormsIds);
|
|
5268
|
+
const newPendingIds = formInitResult.pendingUserFormsIds.filter(
|
|
5269
|
+
(id) => !existingPendingIds.has(id)
|
|
5270
|
+
);
|
|
5271
|
+
updatedPendingUserFormsIds = [...updatedPendingUserFormsIds, ...newPendingIds];
|
|
5264
5272
|
}
|
|
5265
5273
|
const extendedProcedures = [...metadata.extendedProcedures || [], extendedProcedureInfo];
|
|
5266
5274
|
const appointmentRef = doc7(db, APPOINTMENTS_COLLECTION, appointmentId);
|
|
@@ -5303,15 +5311,30 @@ async function removeExtendedProcedureUtil(db, appointmentId, procedureId) {
|
|
|
5303
5311
|
`\u{1F5D1}\uFE0F [removeExtendedProcedure] Removed ${productsRemovedFromZones} products from zones for procedure ${procedureId}`
|
|
5304
5312
|
);
|
|
5305
5313
|
const removedFormIds = await removeFormsForExtendedProcedure(db, appointmentId, procedureId);
|
|
5306
|
-
const
|
|
5307
|
-
|
|
5308
|
-
)
|
|
5309
|
-
|
|
5310
|
-
(
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
);
|
|
5314
|
+
const removedFormIdsSet = new Set(removedFormIds);
|
|
5315
|
+
const linkedFormIdsSet = /* @__PURE__ */ new Set();
|
|
5316
|
+
const updatedLinkedFormIds = (appointment.linkedFormIds || []).filter((formId) => {
|
|
5317
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
5318
|
+
if (linkedFormIdsSet.has(formId)) return false;
|
|
5319
|
+
linkedFormIdsSet.add(formId);
|
|
5320
|
+
return true;
|
|
5321
|
+
});
|
|
5322
|
+
const linkedFormsMap = /* @__PURE__ */ new Map();
|
|
5323
|
+
(appointment.linkedForms || []).forEach((form) => {
|
|
5324
|
+
if (!removedFormIdsSet.has(form.formId)) {
|
|
5325
|
+
if (!linkedFormsMap.has(form.formId)) {
|
|
5326
|
+
linkedFormsMap.set(form.formId, form);
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
});
|
|
5330
|
+
const updatedLinkedForms = Array.from(linkedFormsMap.values());
|
|
5331
|
+
const pendingIdsSet = /* @__PURE__ */ new Set();
|
|
5332
|
+
const updatedPendingUserFormsIds = (appointment.pendingUserFormsIds || []).filter((formId) => {
|
|
5333
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
5334
|
+
if (pendingIdsSet.has(formId)) return false;
|
|
5335
|
+
pendingIdsSet.add(formId);
|
|
5336
|
+
return true;
|
|
5337
|
+
});
|
|
5315
5338
|
const appointmentRef = doc7(db, APPOINTMENTS_COLLECTION, appointmentId);
|
|
5316
5339
|
await updateDoc5(appointmentRef, {
|
|
5317
5340
|
"metadata.extendedProcedures": metadata.extendedProcedures,
|
package/package.json
CHANGED
|
@@ -98,6 +98,7 @@ async function createExtendedProcedureInfo(
|
|
|
98
98
|
return {
|
|
99
99
|
procedureId: procedureId,
|
|
100
100
|
procedureName: data.name,
|
|
101
|
+
procedureDescription: data.description || '',
|
|
101
102
|
procedureFamily: data.family, // Use embedded family object
|
|
102
103
|
procedureCategoryId: data.category.id, // Access embedded category
|
|
103
104
|
procedureCategoryName: data.category.name, // Access embedded category
|
|
@@ -174,13 +175,25 @@ export async function addExtendedProcedureUtil(
|
|
|
174
175
|
appointment.clinicBranchId,
|
|
175
176
|
);
|
|
176
177
|
|
|
177
|
-
// Merge form IDs and info
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
// Merge form IDs and info with deduplication
|
|
179
|
+
// Deduplicate linkedFormIds by formId
|
|
180
|
+
const existingFormIds = new Set(updatedLinkedFormIds);
|
|
181
|
+
const newFormIds = formInitResult.allLinkedFormIds.filter(id => !existingFormIds.has(id));
|
|
182
|
+
updatedLinkedFormIds = [...updatedLinkedFormIds, ...newFormIds];
|
|
183
|
+
|
|
184
|
+
// Deduplicate linkedForms by formId (keep existing entries, add only new ones)
|
|
185
|
+
const existingFormIdsInLinkedForms = new Set(updatedLinkedForms.map(f => f.formId));
|
|
186
|
+
const newLinkedForms = formInitResult.initializedFormsInfo.filter(
|
|
187
|
+
form => !existingFormIdsInLinkedForms.has(form.formId)
|
|
188
|
+
);
|
|
189
|
+
updatedLinkedForms = [...updatedLinkedForms, ...newLinkedForms];
|
|
190
|
+
|
|
191
|
+
// Deduplicate pendingUserFormsIds
|
|
192
|
+
const existingPendingIds = new Set(updatedPendingUserFormsIds);
|
|
193
|
+
const newPendingIds = formInitResult.pendingUserFormsIds.filter(
|
|
194
|
+
id => !existingPendingIds.has(id)
|
|
195
|
+
);
|
|
196
|
+
updatedPendingUserFormsIds = [...updatedPendingUserFormsIds, ...newPendingIds];
|
|
184
197
|
}
|
|
185
198
|
|
|
186
199
|
// Add extended procedure
|
|
@@ -259,16 +272,41 @@ export async function removeExtendedProcedureUtil(
|
|
|
259
272
|
// Remove forms associated with this procedure
|
|
260
273
|
const removedFormIds = await removeFormsForExtendedProcedure(db, appointmentId, procedureId);
|
|
261
274
|
|
|
262
|
-
// Update appointment form arrays
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
// Update appointment form arrays - remove forms that were deleted
|
|
276
|
+
// Also deduplicate to clean up any existing duplicates
|
|
277
|
+
const removedFormIdsSet = new Set(removedFormIds);
|
|
278
|
+
|
|
279
|
+
// Deduplicate and filter linkedFormIds
|
|
280
|
+
const linkedFormIdsSet = new Set<string>();
|
|
281
|
+
const updatedLinkedFormIds = (appointment.linkedFormIds || [])
|
|
282
|
+
.filter(formId => {
|
|
283
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
284
|
+
if (linkedFormIdsSet.has(formId)) return false; // Deduplicate
|
|
285
|
+
linkedFormIdsSet.add(formId);
|
|
286
|
+
return true;
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Deduplicate and filter linkedForms by formId
|
|
290
|
+
const linkedFormsMap = new Map<string, LinkedFormInfo>();
|
|
291
|
+
(appointment.linkedForms || []).forEach(form => {
|
|
292
|
+
if (!removedFormIdsSet.has(form.formId)) {
|
|
293
|
+
// Keep the first occurrence if duplicates exist
|
|
294
|
+
if (!linkedFormsMap.has(form.formId)) {
|
|
295
|
+
linkedFormsMap.set(form.formId, form);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
const updatedLinkedForms = Array.from(linkedFormsMap.values());
|
|
300
|
+
|
|
301
|
+
// Deduplicate and filter pendingUserFormsIds
|
|
302
|
+
const pendingIdsSet = new Set<string>();
|
|
303
|
+
const updatedPendingUserFormsIds = (appointment.pendingUserFormsIds || [])
|
|
304
|
+
.filter(formId => {
|
|
305
|
+
if (removedFormIdsSet.has(formId)) return false;
|
|
306
|
+
if (pendingIdsSet.has(formId)) return false; // Deduplicate
|
|
307
|
+
pendingIdsSet.add(formId);
|
|
308
|
+
return true;
|
|
309
|
+
});
|
|
272
310
|
|
|
273
311
|
// Update appointment
|
|
274
312
|
const appointmentRef = doc(db, APPOINTMENTS_COLLECTION, appointmentId);
|
|
@@ -168,7 +168,8 @@ export interface ZoneItemData {
|
|
|
168
168
|
notes?: string;
|
|
169
169
|
notesVisibleToPatient?: boolean; // Whether notes are visible to patient (privacy-first, default false)
|
|
170
170
|
subtotal?: number;
|
|
171
|
-
ionNumber?: string;
|
|
171
|
+
ionNumber?: string; // Batch/Lot number
|
|
172
|
+
expiryDate?: string; // ISO date string (YYYY-MM-DD)
|
|
172
173
|
createdAt?: string; // ISO timestamp
|
|
173
174
|
updatedAt?: string; // ISO timestamp
|
|
174
175
|
}
|
|
@@ -224,6 +225,7 @@ export interface AppointmentProductMetadata {
|
|
|
224
225
|
export interface ExtendedProcedureInfo {
|
|
225
226
|
procedureId: string;
|
|
226
227
|
procedureName: string;
|
|
228
|
+
procedureDescription?: string;
|
|
227
229
|
procedureFamily?: ProcedureFamily;
|
|
228
230
|
procedureCategoryId: string;
|
|
229
231
|
procedureCategoryName: string;
|