@blackcode_sa/metaestetics-api 1.5.11 → 1.5.13
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/backoffice/index.d.mts +282 -220
- package/dist/backoffice/index.d.ts +282 -220
- package/dist/backoffice/index.js +90 -65
- package/dist/backoffice/index.mjs +90 -66
- package/dist/index.d.mts +113 -63
- package/dist/index.d.ts +113 -63
- package/dist/index.js +88 -67
- package/dist/index.mjs +88 -68
- package/package.json +1 -1
- package/src/backoffice/services/brand.service.ts +33 -10
- package/src/backoffice/services/product.service.ts +69 -88
- package/src/backoffice/types/product.types.ts +77 -17
- package/src/backoffice/types/technology.types.ts +1 -31
- package/src/backoffice/validations/schemas.ts +2 -0
- package/src/services/procedure/procedure.service.ts +0 -2
package/dist/backoffice/index.js
CHANGED
|
@@ -560,6 +560,8 @@ var technologySchema = import_zod2.z.object({
|
|
|
560
560
|
name: import_zod2.z.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
561
561
|
description: import_zod2.z.string().max(1e3, "Description is too long").optional(),
|
|
562
562
|
technicalDetails: import_zod2.z.string().max(2e3, "Technical details are too long").optional(),
|
|
563
|
+
family: procedureFamilySchema,
|
|
564
|
+
categoryId: import_zod2.z.string().min(1, "Category ID is required"),
|
|
563
565
|
subcategoryId: import_zod2.z.string().min(1, "Subcategory ID is required"),
|
|
564
566
|
requirements: technologyRequirementsSchema.default({
|
|
565
567
|
pre: [],
|
|
@@ -1325,9 +1327,15 @@ var RequirementService = class extends BaseService {
|
|
|
1325
1327
|
// src/backoffice/services/brand.service.ts
|
|
1326
1328
|
var import_firestore5 = require("firebase/firestore");
|
|
1327
1329
|
var BrandService = class extends BaseService {
|
|
1328
|
-
|
|
1330
|
+
/**
|
|
1331
|
+
* Gets reference to brands collection
|
|
1332
|
+
*/
|
|
1333
|
+
getBrandsRef() {
|
|
1329
1334
|
return (0, import_firestore5.collection)(this.db, BRANDS_COLLECTION);
|
|
1330
1335
|
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Creates a new brand
|
|
1338
|
+
*/
|
|
1331
1339
|
async create(brand) {
|
|
1332
1340
|
const now = /* @__PURE__ */ new Date();
|
|
1333
1341
|
const newBrand = {
|
|
@@ -1336,11 +1344,14 @@ var BrandService = class extends BaseService {
|
|
|
1336
1344
|
updatedAt: now,
|
|
1337
1345
|
isActive: true
|
|
1338
1346
|
};
|
|
1339
|
-
const docRef = await (0, import_firestore5.addDoc)(this.
|
|
1347
|
+
const docRef = await (0, import_firestore5.addDoc)(this.getBrandsRef(), newBrand);
|
|
1340
1348
|
return { id: docRef.id, ...newBrand };
|
|
1341
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Gets all active brands
|
|
1352
|
+
*/
|
|
1342
1353
|
async getAll() {
|
|
1343
|
-
const q = (0, import_firestore5.query)(this.
|
|
1354
|
+
const q = (0, import_firestore5.query)(this.getBrandsRef(), (0, import_firestore5.where)("isActive", "==", true));
|
|
1344
1355
|
const snapshot = await (0, import_firestore5.getDocs)(q);
|
|
1345
1356
|
return snapshot.docs.map(
|
|
1346
1357
|
(doc9) => ({
|
|
@@ -1349,20 +1360,31 @@ var BrandService = class extends BaseService {
|
|
|
1349
1360
|
})
|
|
1350
1361
|
);
|
|
1351
1362
|
}
|
|
1352
|
-
|
|
1363
|
+
/**
|
|
1364
|
+
* Updates a brand
|
|
1365
|
+
*/
|
|
1366
|
+
async update(brandId, brand) {
|
|
1353
1367
|
const updateData = {
|
|
1354
1368
|
...brand,
|
|
1355
1369
|
updatedAt: /* @__PURE__ */ new Date()
|
|
1356
1370
|
};
|
|
1357
|
-
const docRef = (0, import_firestore5.doc)(this.
|
|
1371
|
+
const docRef = (0, import_firestore5.doc)(this.getBrandsRef(), brandId);
|
|
1358
1372
|
await (0, import_firestore5.updateDoc)(docRef, updateData);
|
|
1359
|
-
return this.getById(
|
|
1373
|
+
return this.getById(brandId);
|
|
1360
1374
|
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1375
|
+
/**
|
|
1376
|
+
* Soft deletes a brand
|
|
1377
|
+
*/
|
|
1378
|
+
async delete(brandId) {
|
|
1379
|
+
await this.update(brandId, {
|
|
1380
|
+
isActive: false
|
|
1381
|
+
});
|
|
1363
1382
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1383
|
+
/**
|
|
1384
|
+
* Gets a brand by ID
|
|
1385
|
+
*/
|
|
1386
|
+
async getById(brandId) {
|
|
1387
|
+
const docRef = (0, import_firestore5.doc)(this.getBrandsRef(), brandId);
|
|
1366
1388
|
const docSnap = await (0, import_firestore5.getDoc)(docRef);
|
|
1367
1389
|
if (!docSnap.exists()) return null;
|
|
1368
1390
|
return {
|
|
@@ -1375,22 +1397,23 @@ var BrandService = class extends BaseService {
|
|
|
1375
1397
|
// src/backoffice/services/product.service.ts
|
|
1376
1398
|
var import_firestore6 = require("firebase/firestore");
|
|
1377
1399
|
var ProductService = class extends BaseService {
|
|
1378
|
-
|
|
1400
|
+
/**
|
|
1401
|
+
* Gets reference to products collection under a technology
|
|
1402
|
+
* @param technologyId - ID of the technology
|
|
1403
|
+
* @returns Firestore collection reference
|
|
1404
|
+
*/
|
|
1405
|
+
getProductsRef(technologyId) {
|
|
1379
1406
|
return (0, import_firestore6.collection)(
|
|
1380
1407
|
this.db,
|
|
1381
|
-
CATEGORIES_COLLECTION,
|
|
1382
|
-
categoryId,
|
|
1383
|
-
SUBCATEGORIES_COLLECTION,
|
|
1384
|
-
subcategoryId,
|
|
1385
1408
|
TECHNOLOGIES_COLLECTION,
|
|
1386
1409
|
technologyId,
|
|
1387
1410
|
PRODUCTS_COLLECTION
|
|
1388
1411
|
);
|
|
1389
1412
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
async create(
|
|
1413
|
+
/**
|
|
1414
|
+
* Creates a new product under technology
|
|
1415
|
+
*/
|
|
1416
|
+
async create(technologyId, brandId, product) {
|
|
1394
1417
|
const now = /* @__PURE__ */ new Date();
|
|
1395
1418
|
const newProduct = {
|
|
1396
1419
|
...product,
|
|
@@ -1400,23 +1423,18 @@ var ProductService = class extends BaseService {
|
|
|
1400
1423
|
updatedAt: now,
|
|
1401
1424
|
isActive: true
|
|
1402
1425
|
};
|
|
1403
|
-
const
|
|
1404
|
-
this.
|
|
1426
|
+
const productRef = await (0, import_firestore6.addDoc)(
|
|
1427
|
+
this.getProductsRef(technologyId),
|
|
1405
1428
|
newProduct
|
|
1406
1429
|
);
|
|
1407
|
-
|
|
1408
|
-
...newProduct,
|
|
1409
|
-
id: techProductRef.id,
|
|
1410
|
-
// Store the original ID for reference
|
|
1411
|
-
categoryId,
|
|
1412
|
-
subcategoryId,
|
|
1413
|
-
technologyId
|
|
1414
|
-
});
|
|
1415
|
-
return { id: techProductRef.id, ...newProduct };
|
|
1430
|
+
return { id: productRef.id, ...newProduct };
|
|
1416
1431
|
}
|
|
1417
|
-
|
|
1432
|
+
/**
|
|
1433
|
+
* Gets all products for a technology
|
|
1434
|
+
*/
|
|
1435
|
+
async getAllByTechnology(technologyId) {
|
|
1418
1436
|
const q = (0, import_firestore6.query)(
|
|
1419
|
-
this.
|
|
1437
|
+
this.getProductsRef(technologyId),
|
|
1420
1438
|
(0, import_firestore6.where)("isActive", "==", true)
|
|
1421
1439
|
);
|
|
1422
1440
|
const snapshot = await (0, import_firestore6.getDocs)(q);
|
|
@@ -1427,49 +1445,56 @@ var ProductService = class extends BaseService {
|
|
|
1427
1445
|
})
|
|
1428
1446
|
);
|
|
1429
1447
|
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Gets all products for a brand by filtering through all technologies
|
|
1450
|
+
*/
|
|
1430
1451
|
async getAllByBrand(brandId) {
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
)
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1452
|
+
const allTechnologiesRef = (0, import_firestore6.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
1453
|
+
const technologiesSnapshot = await (0, import_firestore6.getDocs)(allTechnologiesRef);
|
|
1454
|
+
const products = [];
|
|
1455
|
+
for (const techDoc of technologiesSnapshot.docs) {
|
|
1456
|
+
const q = (0, import_firestore6.query)(
|
|
1457
|
+
this.getProductsRef(techDoc.id),
|
|
1458
|
+
(0, import_firestore6.where)("brandId", "==", brandId),
|
|
1459
|
+
(0, import_firestore6.where)("isActive", "==", true)
|
|
1460
|
+
);
|
|
1461
|
+
const snapshot = await (0, import_firestore6.getDocs)(q);
|
|
1462
|
+
products.push(
|
|
1463
|
+
...snapshot.docs.map(
|
|
1464
|
+
(doc9) => ({
|
|
1465
|
+
id: doc9.id,
|
|
1466
|
+
...doc9.data()
|
|
1467
|
+
})
|
|
1468
|
+
)
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
return products;
|
|
1442
1472
|
}
|
|
1443
|
-
|
|
1473
|
+
/**
|
|
1474
|
+
* Updates a product
|
|
1475
|
+
*/
|
|
1476
|
+
async update(technologyId, productId, product) {
|
|
1444
1477
|
const updateData = {
|
|
1445
1478
|
...product,
|
|
1446
1479
|
updatedAt: /* @__PURE__ */ new Date()
|
|
1447
1480
|
};
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
);
|
|
1452
|
-
await (0, import_firestore6.updateDoc)(techDocRef, updateData);
|
|
1453
|
-
const brandProductsQuery = (0, import_firestore6.query)(
|
|
1454
|
-
(0, import_firestore6.collectionGroup)(this.db, PRODUCTS_COLLECTION),
|
|
1455
|
-
(0, import_firestore6.where)("id", "==", productId)
|
|
1456
|
-
);
|
|
1457
|
-
const brandProductsSnapshot = await (0, import_firestore6.getDocs)(brandProductsQuery);
|
|
1458
|
-
for (const doc9 of brandProductsSnapshot.docs) {
|
|
1459
|
-
await (0, import_firestore6.updateDoc)(doc9.ref, updateData);
|
|
1460
|
-
}
|
|
1461
|
-
return this.getById(categoryId, subcategoryId, technologyId, productId);
|
|
1481
|
+
const docRef = (0, import_firestore6.doc)(this.getProductsRef(technologyId), productId);
|
|
1482
|
+
await (0, import_firestore6.updateDoc)(docRef, updateData);
|
|
1483
|
+
return this.getById(technologyId, productId);
|
|
1462
1484
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1485
|
+
/**
|
|
1486
|
+
* Soft deletes a product
|
|
1487
|
+
*/
|
|
1488
|
+
async delete(technologyId, productId) {
|
|
1489
|
+
await this.update(technologyId, productId, {
|
|
1465
1490
|
isActive: false
|
|
1466
1491
|
});
|
|
1467
1492
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
);
|
|
1493
|
+
/**
|
|
1494
|
+
* Gets a product by ID
|
|
1495
|
+
*/
|
|
1496
|
+
async getById(technologyId, productId) {
|
|
1497
|
+
const docRef = (0, import_firestore6.doc)(this.getProductsRef(technologyId), productId);
|
|
1473
1498
|
const docSnap = await (0, import_firestore6.getDoc)(docRef);
|
|
1474
1499
|
if (!docSnap.exists()) return null;
|
|
1475
1500
|
return {
|
|
@@ -468,6 +468,8 @@ var technologySchema = z2.object({
|
|
|
468
468
|
name: z2.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
469
469
|
description: z2.string().max(1e3, "Description is too long").optional(),
|
|
470
470
|
technicalDetails: z2.string().max(2e3, "Technical details are too long").optional(),
|
|
471
|
+
family: procedureFamilySchema,
|
|
472
|
+
categoryId: z2.string().min(1, "Category ID is required"),
|
|
471
473
|
subcategoryId: z2.string().min(1, "Subcategory ID is required"),
|
|
472
474
|
requirements: technologyRequirementsSchema.default({
|
|
473
475
|
pre: [],
|
|
@@ -1280,9 +1282,15 @@ import {
|
|
|
1280
1282
|
where as where5
|
|
1281
1283
|
} from "firebase/firestore";
|
|
1282
1284
|
var BrandService = class extends BaseService {
|
|
1283
|
-
|
|
1285
|
+
/**
|
|
1286
|
+
* Gets reference to brands collection
|
|
1287
|
+
*/
|
|
1288
|
+
getBrandsRef() {
|
|
1284
1289
|
return collection5(this.db, BRANDS_COLLECTION);
|
|
1285
1290
|
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Creates a new brand
|
|
1293
|
+
*/
|
|
1286
1294
|
async create(brand) {
|
|
1287
1295
|
const now = /* @__PURE__ */ new Date();
|
|
1288
1296
|
const newBrand = {
|
|
@@ -1291,11 +1299,14 @@ var BrandService = class extends BaseService {
|
|
|
1291
1299
|
updatedAt: now,
|
|
1292
1300
|
isActive: true
|
|
1293
1301
|
};
|
|
1294
|
-
const docRef = await addDoc5(this.
|
|
1302
|
+
const docRef = await addDoc5(this.getBrandsRef(), newBrand);
|
|
1295
1303
|
return { id: docRef.id, ...newBrand };
|
|
1296
1304
|
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Gets all active brands
|
|
1307
|
+
*/
|
|
1297
1308
|
async getAll() {
|
|
1298
|
-
const q = query5(this.
|
|
1309
|
+
const q = query5(this.getBrandsRef(), where5("isActive", "==", true));
|
|
1299
1310
|
const snapshot = await getDocs5(q);
|
|
1300
1311
|
return snapshot.docs.map(
|
|
1301
1312
|
(doc9) => ({
|
|
@@ -1304,20 +1315,31 @@ var BrandService = class extends BaseService {
|
|
|
1304
1315
|
})
|
|
1305
1316
|
);
|
|
1306
1317
|
}
|
|
1307
|
-
|
|
1318
|
+
/**
|
|
1319
|
+
* Updates a brand
|
|
1320
|
+
*/
|
|
1321
|
+
async update(brandId, brand) {
|
|
1308
1322
|
const updateData = {
|
|
1309
1323
|
...brand,
|
|
1310
1324
|
updatedAt: /* @__PURE__ */ new Date()
|
|
1311
1325
|
};
|
|
1312
|
-
const docRef = doc5(this.
|
|
1326
|
+
const docRef = doc5(this.getBrandsRef(), brandId);
|
|
1313
1327
|
await updateDoc5(docRef, updateData);
|
|
1314
|
-
return this.getById(
|
|
1328
|
+
return this.getById(brandId);
|
|
1315
1329
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1330
|
+
/**
|
|
1331
|
+
* Soft deletes a brand
|
|
1332
|
+
*/
|
|
1333
|
+
async delete(brandId) {
|
|
1334
|
+
await this.update(brandId, {
|
|
1335
|
+
isActive: false
|
|
1336
|
+
});
|
|
1318
1337
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1338
|
+
/**
|
|
1339
|
+
* Gets a brand by ID
|
|
1340
|
+
*/
|
|
1341
|
+
async getById(brandId) {
|
|
1342
|
+
const docRef = doc5(this.getBrandsRef(), brandId);
|
|
1321
1343
|
const docSnap = await getDoc5(docRef);
|
|
1322
1344
|
if (!docSnap.exists()) return null;
|
|
1323
1345
|
return {
|
|
@@ -1331,7 +1353,6 @@ var BrandService = class extends BaseService {
|
|
|
1331
1353
|
import {
|
|
1332
1354
|
addDoc as addDoc6,
|
|
1333
1355
|
collection as collection6,
|
|
1334
|
-
collectionGroup,
|
|
1335
1356
|
doc as doc6,
|
|
1336
1357
|
getDoc as getDoc6,
|
|
1337
1358
|
getDocs as getDocs6,
|
|
@@ -1340,22 +1361,23 @@ import {
|
|
|
1340
1361
|
where as where6
|
|
1341
1362
|
} from "firebase/firestore";
|
|
1342
1363
|
var ProductService = class extends BaseService {
|
|
1343
|
-
|
|
1364
|
+
/**
|
|
1365
|
+
* Gets reference to products collection under a technology
|
|
1366
|
+
* @param technologyId - ID of the technology
|
|
1367
|
+
* @returns Firestore collection reference
|
|
1368
|
+
*/
|
|
1369
|
+
getProductsRef(technologyId) {
|
|
1344
1370
|
return collection6(
|
|
1345
1371
|
this.db,
|
|
1346
|
-
CATEGORIES_COLLECTION,
|
|
1347
|
-
categoryId,
|
|
1348
|
-
SUBCATEGORIES_COLLECTION,
|
|
1349
|
-
subcategoryId,
|
|
1350
1372
|
TECHNOLOGIES_COLLECTION,
|
|
1351
1373
|
technologyId,
|
|
1352
1374
|
PRODUCTS_COLLECTION
|
|
1353
1375
|
);
|
|
1354
1376
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
async create(
|
|
1377
|
+
/**
|
|
1378
|
+
* Creates a new product under technology
|
|
1379
|
+
*/
|
|
1380
|
+
async create(technologyId, brandId, product) {
|
|
1359
1381
|
const now = /* @__PURE__ */ new Date();
|
|
1360
1382
|
const newProduct = {
|
|
1361
1383
|
...product,
|
|
@@ -1365,23 +1387,18 @@ var ProductService = class extends BaseService {
|
|
|
1365
1387
|
updatedAt: now,
|
|
1366
1388
|
isActive: true
|
|
1367
1389
|
};
|
|
1368
|
-
const
|
|
1369
|
-
this.
|
|
1390
|
+
const productRef = await addDoc6(
|
|
1391
|
+
this.getProductsRef(technologyId),
|
|
1370
1392
|
newProduct
|
|
1371
1393
|
);
|
|
1372
|
-
|
|
1373
|
-
...newProduct,
|
|
1374
|
-
id: techProductRef.id,
|
|
1375
|
-
// Store the original ID for reference
|
|
1376
|
-
categoryId,
|
|
1377
|
-
subcategoryId,
|
|
1378
|
-
technologyId
|
|
1379
|
-
});
|
|
1380
|
-
return { id: techProductRef.id, ...newProduct };
|
|
1394
|
+
return { id: productRef.id, ...newProduct };
|
|
1381
1395
|
}
|
|
1382
|
-
|
|
1396
|
+
/**
|
|
1397
|
+
* Gets all products for a technology
|
|
1398
|
+
*/
|
|
1399
|
+
async getAllByTechnology(technologyId) {
|
|
1383
1400
|
const q = query6(
|
|
1384
|
-
this.
|
|
1401
|
+
this.getProductsRef(technologyId),
|
|
1385
1402
|
where6("isActive", "==", true)
|
|
1386
1403
|
);
|
|
1387
1404
|
const snapshot = await getDocs6(q);
|
|
@@ -1392,49 +1409,56 @@ var ProductService = class extends BaseService {
|
|
|
1392
1409
|
})
|
|
1393
1410
|
);
|
|
1394
1411
|
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Gets all products for a brand by filtering through all technologies
|
|
1414
|
+
*/
|
|
1395
1415
|
async getAllByBrand(brandId) {
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
)
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1416
|
+
const allTechnologiesRef = collection6(this.db, TECHNOLOGIES_COLLECTION);
|
|
1417
|
+
const technologiesSnapshot = await getDocs6(allTechnologiesRef);
|
|
1418
|
+
const products = [];
|
|
1419
|
+
for (const techDoc of technologiesSnapshot.docs) {
|
|
1420
|
+
const q = query6(
|
|
1421
|
+
this.getProductsRef(techDoc.id),
|
|
1422
|
+
where6("brandId", "==", brandId),
|
|
1423
|
+
where6("isActive", "==", true)
|
|
1424
|
+
);
|
|
1425
|
+
const snapshot = await getDocs6(q);
|
|
1426
|
+
products.push(
|
|
1427
|
+
...snapshot.docs.map(
|
|
1428
|
+
(doc9) => ({
|
|
1429
|
+
id: doc9.id,
|
|
1430
|
+
...doc9.data()
|
|
1431
|
+
})
|
|
1432
|
+
)
|
|
1433
|
+
);
|
|
1434
|
+
}
|
|
1435
|
+
return products;
|
|
1407
1436
|
}
|
|
1408
|
-
|
|
1437
|
+
/**
|
|
1438
|
+
* Updates a product
|
|
1439
|
+
*/
|
|
1440
|
+
async update(technologyId, productId, product) {
|
|
1409
1441
|
const updateData = {
|
|
1410
1442
|
...product,
|
|
1411
1443
|
updatedAt: /* @__PURE__ */ new Date()
|
|
1412
1444
|
};
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
);
|
|
1417
|
-
await updateDoc6(techDocRef, updateData);
|
|
1418
|
-
const brandProductsQuery = query6(
|
|
1419
|
-
collectionGroup(this.db, PRODUCTS_COLLECTION),
|
|
1420
|
-
where6("id", "==", productId)
|
|
1421
|
-
);
|
|
1422
|
-
const brandProductsSnapshot = await getDocs6(brandProductsQuery);
|
|
1423
|
-
for (const doc9 of brandProductsSnapshot.docs) {
|
|
1424
|
-
await updateDoc6(doc9.ref, updateData);
|
|
1425
|
-
}
|
|
1426
|
-
return this.getById(categoryId, subcategoryId, technologyId, productId);
|
|
1445
|
+
const docRef = doc6(this.getProductsRef(technologyId), productId);
|
|
1446
|
+
await updateDoc6(docRef, updateData);
|
|
1447
|
+
return this.getById(technologyId, productId);
|
|
1427
1448
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1449
|
+
/**
|
|
1450
|
+
* Soft deletes a product
|
|
1451
|
+
*/
|
|
1452
|
+
async delete(technologyId, productId) {
|
|
1453
|
+
await this.update(technologyId, productId, {
|
|
1430
1454
|
isActive: false
|
|
1431
1455
|
});
|
|
1432
1456
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
);
|
|
1457
|
+
/**
|
|
1458
|
+
* Gets a product by ID
|
|
1459
|
+
*/
|
|
1460
|
+
async getById(technologyId, productId) {
|
|
1461
|
+
const docRef = doc6(this.getProductsRef(technologyId), productId);
|
|
1438
1462
|
const docSnap = await getDoc6(docRef);
|
|
1439
1463
|
if (!docSnap.exists()) return null;
|
|
1440
1464
|
return {
|