@blackcode_sa/metaestetics-api 1.12.42 → 1.12.45
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 +6 -12
- package/dist/admin/index.d.ts +6 -12
- package/dist/backoffice/index.d.mts +18 -182
- package/dist/backoffice/index.d.ts +18 -182
- package/dist/backoffice/index.js +14 -302
- package/dist/backoffice/index.mjs +27 -318
- package/dist/index.d.mts +10 -174
- package/dist/index.d.ts +10 -174
- package/dist/index.js +32 -309
- package/dist/index.mjs +40 -320
- package/package.json +1 -1
- package/src/backoffice/services/product.service.ts +18 -216
- package/src/backoffice/services/technology.service.ts +0 -169
- package/src/backoffice/types/product.types.ts +6 -116
- package/src/services/appointment/utils/zone-management.utils.ts +17 -3
- package/src/backoffice/services/migrate-products.ts +0 -116
|
@@ -1158,9 +1158,7 @@ import {
|
|
|
1158
1158
|
limit as limit6,
|
|
1159
1159
|
orderBy as orderBy6,
|
|
1160
1160
|
startAfter as startAfter5,
|
|
1161
|
-
getCountFromServer as getCountFromServer4
|
|
1162
|
-
arrayUnion,
|
|
1163
|
-
arrayRemove
|
|
1161
|
+
getCountFromServer as getCountFromServer4
|
|
1164
1162
|
} from "firebase/firestore";
|
|
1165
1163
|
|
|
1166
1164
|
// src/backoffice/types/product.types.ts
|
|
@@ -1172,14 +1170,7 @@ var TECHNOLOGIES_COLLECTION = "technologies";
|
|
|
1172
1170
|
// src/backoffice/services/product.service.ts
|
|
1173
1171
|
var ProductService = class extends BaseService {
|
|
1174
1172
|
/**
|
|
1175
|
-
* Gets reference to
|
|
1176
|
-
* @returns Firestore collection reference
|
|
1177
|
-
*/
|
|
1178
|
-
getTopLevelProductsRef() {
|
|
1179
|
-
return collection6(this.db, PRODUCTS_COLLECTION);
|
|
1180
|
-
}
|
|
1181
|
-
/**
|
|
1182
|
-
* Gets reference to products collection under a technology (backward compatibility)
|
|
1173
|
+
* Gets reference to products collection under a technology
|
|
1183
1174
|
* @param technologyId - ID of the technology
|
|
1184
1175
|
* @returns Firestore collection reference
|
|
1185
1176
|
*/
|
|
@@ -1195,7 +1186,6 @@ var ProductService = class extends BaseService {
|
|
|
1195
1186
|
...product,
|
|
1196
1187
|
brandId,
|
|
1197
1188
|
technologyId,
|
|
1198
|
-
// Required for old subcollection structure
|
|
1199
1189
|
createdAt: now,
|
|
1200
1190
|
updatedAt: now,
|
|
1201
1191
|
isActive: true
|
|
@@ -1255,26 +1245,30 @@ var ProductService = class extends BaseService {
|
|
|
1255
1245
|
}
|
|
1256
1246
|
/**
|
|
1257
1247
|
* Gets counts of active products grouped by category, subcategory, and technology.
|
|
1258
|
-
*
|
|
1248
|
+
* This uses a single collectionGroup query for efficiency.
|
|
1259
1249
|
*/
|
|
1260
1250
|
async getProductCounts() {
|
|
1251
|
+
const q = query6(collectionGroup(this.db, PRODUCTS_COLLECTION), where6("isActive", "==", true));
|
|
1252
|
+
const snapshot = await getDocs6(q);
|
|
1261
1253
|
const counts = {
|
|
1262
1254
|
byCategory: {},
|
|
1263
1255
|
bySubcategory: {},
|
|
1264
1256
|
byTechnology: {}
|
|
1265
1257
|
};
|
|
1266
|
-
|
|
1267
|
-
|
|
1258
|
+
if (snapshot.empty) {
|
|
1259
|
+
return counts;
|
|
1260
|
+
}
|
|
1268
1261
|
snapshot.docs.forEach((doc11) => {
|
|
1269
1262
|
const product = doc11.data();
|
|
1270
|
-
|
|
1271
|
-
|
|
1263
|
+
const { categoryId, subcategoryId, technologyId } = product;
|
|
1264
|
+
if (categoryId) {
|
|
1265
|
+
counts.byCategory[categoryId] = (counts.byCategory[categoryId] || 0) + 1;
|
|
1272
1266
|
}
|
|
1273
|
-
if (
|
|
1274
|
-
counts.bySubcategory[
|
|
1267
|
+
if (subcategoryId) {
|
|
1268
|
+
counts.bySubcategory[subcategoryId] = (counts.bySubcategory[subcategoryId] || 0) + 1;
|
|
1275
1269
|
}
|
|
1276
|
-
if (
|
|
1277
|
-
counts.byTechnology[
|
|
1270
|
+
if (technologyId) {
|
|
1271
|
+
counts.byTechnology[technologyId] = (counts.byTechnology[technologyId] || 0) + 1;
|
|
1278
1272
|
}
|
|
1279
1273
|
});
|
|
1280
1274
|
return counts;
|
|
@@ -1353,160 +1347,6 @@ var ProductService = class extends BaseService {
|
|
|
1353
1347
|
...docSnap.data()
|
|
1354
1348
|
};
|
|
1355
1349
|
}
|
|
1356
|
-
// ==========================================
|
|
1357
|
-
// NEW METHODS: Top-level collection (preferred)
|
|
1358
|
-
// ==========================================
|
|
1359
|
-
/**
|
|
1360
|
-
* Creates a new product in the top-level collection
|
|
1361
|
-
*/
|
|
1362
|
-
async createTopLevel(brandId, product, technologyIds = []) {
|
|
1363
|
-
const now = /* @__PURE__ */ new Date();
|
|
1364
|
-
const newProduct = {
|
|
1365
|
-
...product,
|
|
1366
|
-
brandId,
|
|
1367
|
-
assignedTechnologyIds: technologyIds,
|
|
1368
|
-
createdAt: now,
|
|
1369
|
-
updatedAt: now,
|
|
1370
|
-
isActive: true
|
|
1371
|
-
};
|
|
1372
|
-
const productRef = await addDoc3(this.getTopLevelProductsRef(), newProduct);
|
|
1373
|
-
return { id: productRef.id, ...newProduct };
|
|
1374
|
-
}
|
|
1375
|
-
/**
|
|
1376
|
-
* Gets all products from the top-level collection
|
|
1377
|
-
*/
|
|
1378
|
-
async getAllTopLevel(options) {
|
|
1379
|
-
const { rowsPerPage, lastVisible, brandId } = options;
|
|
1380
|
-
const constraints = [where6("isActive", "==", true), orderBy6("name")];
|
|
1381
|
-
if (brandId) {
|
|
1382
|
-
constraints.push(where6("brandId", "==", brandId));
|
|
1383
|
-
}
|
|
1384
|
-
if (lastVisible) {
|
|
1385
|
-
constraints.push(startAfter5(lastVisible));
|
|
1386
|
-
}
|
|
1387
|
-
constraints.push(limit6(rowsPerPage));
|
|
1388
|
-
const q = query6(this.getTopLevelProductsRef(), ...constraints);
|
|
1389
|
-
const snapshot = await getDocs6(q);
|
|
1390
|
-
const products = snapshot.docs.map(
|
|
1391
|
-
(doc11) => ({
|
|
1392
|
-
id: doc11.id,
|
|
1393
|
-
...doc11.data()
|
|
1394
|
-
})
|
|
1395
|
-
);
|
|
1396
|
-
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
1397
|
-
return { products, lastVisible: newLastVisible };
|
|
1398
|
-
}
|
|
1399
|
-
/**
|
|
1400
|
-
* Gets a product by ID from the top-level collection
|
|
1401
|
-
*/
|
|
1402
|
-
async getByIdTopLevel(productId) {
|
|
1403
|
-
const docRef = doc6(this.getTopLevelProductsRef(), productId);
|
|
1404
|
-
const docSnap = await getDoc6(docRef);
|
|
1405
|
-
if (!docSnap.exists()) return null;
|
|
1406
|
-
return {
|
|
1407
|
-
id: docSnap.id,
|
|
1408
|
-
...docSnap.data()
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* Updates a product in the top-level collection
|
|
1413
|
-
*/
|
|
1414
|
-
async updateTopLevel(productId, product) {
|
|
1415
|
-
const updateData = {
|
|
1416
|
-
...product,
|
|
1417
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1418
|
-
};
|
|
1419
|
-
const docRef = doc6(this.getTopLevelProductsRef(), productId);
|
|
1420
|
-
await updateDoc6(docRef, updateData);
|
|
1421
|
-
return this.getByIdTopLevel(productId);
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Deletes a product from the top-level collection (soft delete)
|
|
1425
|
-
*/
|
|
1426
|
-
async deleteTopLevel(productId) {
|
|
1427
|
-
await this.updateTopLevel(productId, {
|
|
1428
|
-
isActive: false
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
/**
|
|
1432
|
-
* Assigns a product to a technology
|
|
1433
|
-
*/
|
|
1434
|
-
async assignToTechnology(productId, technologyId) {
|
|
1435
|
-
const docRef = doc6(this.getTopLevelProductsRef(), productId);
|
|
1436
|
-
await updateDoc6(docRef, {
|
|
1437
|
-
assignedTechnologyIds: arrayUnion(technologyId),
|
|
1438
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
/**
|
|
1442
|
-
* Unassigns a product from a technology
|
|
1443
|
-
*/
|
|
1444
|
-
async unassignFromTechnology(productId, technologyId) {
|
|
1445
|
-
const docRef = doc6(this.getTopLevelProductsRef(), productId);
|
|
1446
|
-
await updateDoc6(docRef, {
|
|
1447
|
-
assignedTechnologyIds: arrayRemove(technologyId),
|
|
1448
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
/**
|
|
1452
|
-
* Gets products assigned to a specific technology
|
|
1453
|
-
*/
|
|
1454
|
-
async getAssignedProducts(technologyId) {
|
|
1455
|
-
const q = query6(
|
|
1456
|
-
this.getTopLevelProductsRef(),
|
|
1457
|
-
where6("assignedTechnologyIds", "array-contains", technologyId),
|
|
1458
|
-
where6("isActive", "==", true),
|
|
1459
|
-
orderBy6("name")
|
|
1460
|
-
);
|
|
1461
|
-
const snapshot = await getDocs6(q);
|
|
1462
|
-
return snapshot.docs.map(
|
|
1463
|
-
(doc11) => ({
|
|
1464
|
-
id: doc11.id,
|
|
1465
|
-
...doc11.data()
|
|
1466
|
-
})
|
|
1467
|
-
);
|
|
1468
|
-
}
|
|
1469
|
-
/**
|
|
1470
|
-
* Gets products NOT assigned to a specific technology
|
|
1471
|
-
*/
|
|
1472
|
-
async getUnassignedProducts(technologyId) {
|
|
1473
|
-
const q = query6(
|
|
1474
|
-
this.getTopLevelProductsRef(),
|
|
1475
|
-
where6("isActive", "==", true),
|
|
1476
|
-
orderBy6("name")
|
|
1477
|
-
);
|
|
1478
|
-
const snapshot = await getDocs6(q);
|
|
1479
|
-
const allProducts = snapshot.docs.map(
|
|
1480
|
-
(doc11) => ({
|
|
1481
|
-
id: doc11.id,
|
|
1482
|
-
...doc11.data()
|
|
1483
|
-
})
|
|
1484
|
-
);
|
|
1485
|
-
return allProducts.filter(
|
|
1486
|
-
(product) => {
|
|
1487
|
-
var _a;
|
|
1488
|
-
return !((_a = product.assignedTechnologyIds) == null ? void 0 : _a.includes(technologyId));
|
|
1489
|
-
}
|
|
1490
|
-
);
|
|
1491
|
-
}
|
|
1492
|
-
/**
|
|
1493
|
-
* Gets all products for a brand (from top-level collection)
|
|
1494
|
-
*/
|
|
1495
|
-
async getByBrand(brandId) {
|
|
1496
|
-
const q = query6(
|
|
1497
|
-
this.getTopLevelProductsRef(),
|
|
1498
|
-
where6("brandId", "==", brandId),
|
|
1499
|
-
where6("isActive", "==", true),
|
|
1500
|
-
orderBy6("name")
|
|
1501
|
-
);
|
|
1502
|
-
const snapshot = await getDocs6(q);
|
|
1503
|
-
return snapshot.docs.map(
|
|
1504
|
-
(doc11) => ({
|
|
1505
|
-
id: doc11.id,
|
|
1506
|
-
...doc11.data()
|
|
1507
|
-
})
|
|
1508
|
-
);
|
|
1509
|
-
}
|
|
1510
1350
|
};
|
|
1511
1351
|
|
|
1512
1352
|
// src/backoffice/services/requirement.service.ts
|
|
@@ -1897,9 +1737,8 @@ import {
|
|
|
1897
1737
|
startAfter as startAfter7,
|
|
1898
1738
|
updateDoc as updateDoc9,
|
|
1899
1739
|
where as where9,
|
|
1900
|
-
arrayUnion
|
|
1901
|
-
arrayRemove
|
|
1902
|
-
writeBatch
|
|
1740
|
+
arrayUnion,
|
|
1741
|
+
arrayRemove
|
|
1903
1742
|
} from "firebase/firestore";
|
|
1904
1743
|
|
|
1905
1744
|
// src/backoffice/types/static/certification.types.ts
|
|
@@ -2088,18 +1927,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2088
1927
|
});
|
|
2089
1928
|
updateData.updatedAt = /* @__PURE__ */ new Date();
|
|
2090
1929
|
const docRef = doc9(this.technologiesRef, id);
|
|
2091
|
-
const beforeTech = await this.getById(id);
|
|
2092
1930
|
await updateDoc9(docRef, updateData);
|
|
2093
|
-
const categoryChanged = beforeTech && updateData.categoryId && beforeTech.categoryId !== updateData.categoryId;
|
|
2094
|
-
const subcategoryChanged = beforeTech && updateData.subcategoryId && beforeTech.subcategoryId !== updateData.subcategoryId;
|
|
2095
|
-
const nameChanged = beforeTech && updateData.name && beforeTech.name !== updateData.name;
|
|
2096
|
-
if (categoryChanged || subcategoryChanged || nameChanged) {
|
|
2097
|
-
await this.updateProductsInSubcollection(id, {
|
|
2098
|
-
categoryId: updateData.categoryId,
|
|
2099
|
-
subcategoryId: updateData.subcategoryId,
|
|
2100
|
-
technologyName: updateData.name
|
|
2101
|
-
});
|
|
2102
|
-
}
|
|
2103
1931
|
return this.getById(id);
|
|
2104
1932
|
}
|
|
2105
1933
|
/**
|
|
@@ -2140,7 +1968,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2140
1968
|
const docRef = doc9(this.technologiesRef, technologyId);
|
|
2141
1969
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
2142
1970
|
await updateDoc9(docRef, {
|
|
2143
|
-
[requirementType]:
|
|
1971
|
+
[requirementType]: arrayUnion(requirement),
|
|
2144
1972
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2145
1973
|
});
|
|
2146
1974
|
return this.getById(technologyId);
|
|
@@ -2155,7 +1983,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2155
1983
|
const docRef = doc9(this.technologiesRef, technologyId);
|
|
2156
1984
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
2157
1985
|
await updateDoc9(docRef, {
|
|
2158
|
-
[requirementType]:
|
|
1986
|
+
[requirementType]: arrayRemove(requirement),
|
|
2159
1987
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2160
1988
|
});
|
|
2161
1989
|
return this.getById(technologyId);
|
|
@@ -2194,7 +2022,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2194
2022
|
async addBlockingCondition(technologyId, condition) {
|
|
2195
2023
|
const docRef = doc9(this.technologiesRef, technologyId);
|
|
2196
2024
|
await updateDoc9(docRef, {
|
|
2197
|
-
blockingConditions:
|
|
2025
|
+
blockingConditions: arrayUnion(condition),
|
|
2198
2026
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2199
2027
|
});
|
|
2200
2028
|
return this.getById(technologyId);
|
|
@@ -2208,7 +2036,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2208
2036
|
async removeBlockingCondition(technologyId, condition) {
|
|
2209
2037
|
const docRef = doc9(this.technologiesRef, technologyId);
|
|
2210
2038
|
await updateDoc9(docRef, {
|
|
2211
|
-
blockingConditions:
|
|
2039
|
+
blockingConditions: arrayRemove(condition),
|
|
2212
2040
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2213
2041
|
});
|
|
2214
2042
|
return this.getById(technologyId);
|
|
@@ -2535,131 +2363,12 @@ var TechnologyService = class extends BaseService {
|
|
|
2535
2363
|
})
|
|
2536
2364
|
);
|
|
2537
2365
|
}
|
|
2538
|
-
// ==========================================
|
|
2539
|
-
// NEW METHODS: Product assignment management
|
|
2540
|
-
// ==========================================
|
|
2541
|
-
/**
|
|
2542
|
-
* Assigns multiple products to a technology
|
|
2543
|
-
* Updates each product's assignedTechnologyIds array
|
|
2544
|
-
*/
|
|
2545
|
-
async assignProducts(technologyId, productIds) {
|
|
2546
|
-
const batch = writeBatch(this.db);
|
|
2547
|
-
for (const productId of productIds) {
|
|
2548
|
-
const productRef = doc9(this.db, PRODUCTS_COLLECTION, productId);
|
|
2549
|
-
batch.update(productRef, {
|
|
2550
|
-
assignedTechnologyIds: arrayUnion2(technologyId),
|
|
2551
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
2552
|
-
});
|
|
2553
|
-
}
|
|
2554
|
-
await batch.commit();
|
|
2555
|
-
}
|
|
2556
|
-
/**
|
|
2557
|
-
* Unassigns multiple products from a technology
|
|
2558
|
-
* Updates each product's assignedTechnologyIds array
|
|
2559
|
-
*/
|
|
2560
|
-
async unassignProducts(technologyId, productIds) {
|
|
2561
|
-
const batch = writeBatch(this.db);
|
|
2562
|
-
for (const productId of productIds) {
|
|
2563
|
-
const productRef = doc9(this.db, PRODUCTS_COLLECTION, productId);
|
|
2564
|
-
batch.update(productRef, {
|
|
2565
|
-
assignedTechnologyIds: arrayRemove2(technologyId),
|
|
2566
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
2567
|
-
});
|
|
2568
|
-
}
|
|
2569
|
-
await batch.commit();
|
|
2570
|
-
}
|
|
2571
|
-
/**
|
|
2572
|
-
* Gets products assigned to a specific technology
|
|
2573
|
-
* Reads from top-level collection for immediate consistency (Cloud Functions may lag)
|
|
2574
|
-
*/
|
|
2575
|
-
async getAssignedProducts(technologyId) {
|
|
2576
|
-
const q = query9(
|
|
2577
|
-
collection9(this.db, PRODUCTS_COLLECTION),
|
|
2578
|
-
where9("assignedTechnologyIds", "array-contains", technologyId),
|
|
2579
|
-
where9("isActive", "==", true),
|
|
2580
|
-
orderBy8("name")
|
|
2581
|
-
);
|
|
2582
|
-
const snapshot = await getDocs9(q);
|
|
2583
|
-
return snapshot.docs.map(
|
|
2584
|
-
(doc11) => ({
|
|
2585
|
-
id: doc11.id,
|
|
2586
|
-
...doc11.data()
|
|
2587
|
-
})
|
|
2588
|
-
);
|
|
2589
|
-
}
|
|
2590
|
-
/**
|
|
2591
|
-
* Gets products NOT assigned to a specific technology
|
|
2592
|
-
*/
|
|
2593
|
-
async getUnassignedProducts(technologyId) {
|
|
2594
|
-
const q = query9(
|
|
2595
|
-
collection9(this.db, PRODUCTS_COLLECTION),
|
|
2596
|
-
where9("isActive", "==", true),
|
|
2597
|
-
orderBy8("name")
|
|
2598
|
-
);
|
|
2599
|
-
const snapshot = await getDocs9(q);
|
|
2600
|
-
const allProducts = snapshot.docs.map(
|
|
2601
|
-
(doc11) => ({
|
|
2602
|
-
id: doc11.id,
|
|
2603
|
-
...doc11.data()
|
|
2604
|
-
})
|
|
2605
|
-
);
|
|
2606
|
-
return allProducts.filter(
|
|
2607
|
-
(product) => {
|
|
2608
|
-
var _a;
|
|
2609
|
-
return !((_a = product.assignedTechnologyIds) == null ? void 0 : _a.includes(technologyId));
|
|
2610
|
-
}
|
|
2611
|
-
);
|
|
2612
|
-
}
|
|
2613
|
-
/**
|
|
2614
|
-
* Gets product assignment statistics for a technology
|
|
2615
|
-
*/
|
|
2616
|
-
async getProductStats(technologyId) {
|
|
2617
|
-
const products = await this.getAssignedProducts(technologyId);
|
|
2618
|
-
const byBrand = {};
|
|
2619
|
-
products.forEach((product) => {
|
|
2620
|
-
byBrand[product.brandName] = (byBrand[product.brandName] || 0) + 1;
|
|
2621
|
-
});
|
|
2622
|
-
return {
|
|
2623
|
-
totalAssigned: products.length,
|
|
2624
|
-
byBrand
|
|
2625
|
-
};
|
|
2626
|
-
}
|
|
2627
|
-
/**
|
|
2628
|
-
* Updates products in technology subcollection when technology metadata changes
|
|
2629
|
-
* @param technologyId - ID of the technology
|
|
2630
|
-
* @param updates - Fields to update (categoryId, subcategoryId, technologyName)
|
|
2631
|
-
*/
|
|
2632
|
-
async updateProductsInSubcollection(technologyId, updates) {
|
|
2633
|
-
const productsRef = collection9(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
|
|
2634
|
-
const productsSnapshot = await getDocs9(productsRef);
|
|
2635
|
-
if (productsSnapshot.empty) {
|
|
2636
|
-
return;
|
|
2637
|
-
}
|
|
2638
|
-
const batch = writeBatch(this.db);
|
|
2639
|
-
for (const productDoc of productsSnapshot.docs) {
|
|
2640
|
-
const productRef = productDoc.ref;
|
|
2641
|
-
const updateFields = {};
|
|
2642
|
-
if (updates.categoryId !== void 0) {
|
|
2643
|
-
updateFields.categoryId = updates.categoryId;
|
|
2644
|
-
}
|
|
2645
|
-
if (updates.subcategoryId !== void 0) {
|
|
2646
|
-
updateFields.subcategoryId = updates.subcategoryId;
|
|
2647
|
-
}
|
|
2648
|
-
if (updates.technologyName !== void 0) {
|
|
2649
|
-
updateFields.technologyName = updates.technologyName;
|
|
2650
|
-
}
|
|
2651
|
-
if (Object.keys(updateFields).length > 0) {
|
|
2652
|
-
batch.update(productRef, updateFields);
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
await batch.commit();
|
|
2656
|
-
}
|
|
2657
2366
|
};
|
|
2658
2367
|
|
|
2659
2368
|
// src/backoffice/services/constants.service.ts
|
|
2660
2369
|
import {
|
|
2661
|
-
arrayRemove as
|
|
2662
|
-
arrayUnion as
|
|
2370
|
+
arrayRemove as arrayRemove2,
|
|
2371
|
+
arrayUnion as arrayUnion2,
|
|
2663
2372
|
doc as doc10,
|
|
2664
2373
|
getDoc as getDoc10,
|
|
2665
2374
|
setDoc as setDoc5,
|
|
@@ -2727,7 +2436,7 @@ var ConstantsService = class extends BaseService {
|
|
|
2727
2436
|
await setDoc5(this.treatmentBenefitsDocRef, { benefits: [newBenefit] });
|
|
2728
2437
|
} else {
|
|
2729
2438
|
await updateDoc10(this.treatmentBenefitsDocRef, {
|
|
2730
|
-
benefits:
|
|
2439
|
+
benefits: arrayUnion2(newBenefit)
|
|
2731
2440
|
});
|
|
2732
2441
|
}
|
|
2733
2442
|
return newBenefit;
|
|
@@ -2781,7 +2490,7 @@ var ConstantsService = class extends BaseService {
|
|
|
2781
2490
|
return;
|
|
2782
2491
|
}
|
|
2783
2492
|
await updateDoc10(this.treatmentBenefitsDocRef, {
|
|
2784
|
-
benefits:
|
|
2493
|
+
benefits: arrayRemove2(benefitToRemove)
|
|
2785
2494
|
});
|
|
2786
2495
|
}
|
|
2787
2496
|
// =================================================================
|
|
@@ -2834,7 +2543,7 @@ var ConstantsService = class extends BaseService {
|
|
|
2834
2543
|
});
|
|
2835
2544
|
} else {
|
|
2836
2545
|
await updateDoc10(this.contraindicationsDocRef, {
|
|
2837
|
-
contraindications:
|
|
2546
|
+
contraindications: arrayUnion2(newContraindication)
|
|
2838
2547
|
});
|
|
2839
2548
|
}
|
|
2840
2549
|
return newContraindication;
|
|
@@ -2890,7 +2599,7 @@ var ConstantsService = class extends BaseService {
|
|
|
2890
2599
|
return;
|
|
2891
2600
|
}
|
|
2892
2601
|
await updateDoc10(this.contraindicationsDocRef, {
|
|
2893
|
-
contraindications:
|
|
2602
|
+
contraindications: arrayRemove2(toRemove)
|
|
2894
2603
|
});
|
|
2895
2604
|
}
|
|
2896
2605
|
};
|