@dnax/core 0.50.0 → 0.50.2
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/driver/mongo/rest.ts +25 -5
- package/package.json +1 -1
- package/types/tsconfig.json +1 -0
package/driver/mongo/rest.ts
CHANGED
|
@@ -816,7 +816,11 @@ class useRest {
|
|
|
816
816
|
options?: Omit<optionCb, "elementAt">
|
|
817
817
|
): Promise<object | null> {
|
|
818
818
|
return new Promise(async (resolve, reject) => {
|
|
819
|
-
if (!id)
|
|
819
|
+
if (!id)
|
|
820
|
+
return reject({
|
|
821
|
+
code: 400,
|
|
822
|
+
message: "Id required",
|
|
823
|
+
});
|
|
820
824
|
try {
|
|
821
825
|
let meta = {
|
|
822
826
|
total: 0,
|
|
@@ -1009,7 +1013,11 @@ class useRest {
|
|
|
1009
1013
|
return resolve(result);
|
|
1010
1014
|
}
|
|
1011
1015
|
|
|
1012
|
-
if (!id)
|
|
1016
|
+
if (!id)
|
|
1017
|
+
return reject({
|
|
1018
|
+
code: 400,
|
|
1019
|
+
message: "Id required",
|
|
1020
|
+
});
|
|
1013
1021
|
|
|
1014
1022
|
//@ts-expect-error
|
|
1015
1023
|
update = omit(update, omitUpdate);
|
|
@@ -1342,7 +1350,11 @@ class useRest {
|
|
|
1342
1350
|
}
|
|
1343
1351
|
|
|
1344
1352
|
if (Array.isArray(ids)) {
|
|
1345
|
-
if (!ids?.length)
|
|
1353
|
+
if (!ids?.length)
|
|
1354
|
+
return reject({
|
|
1355
|
+
code: 400,
|
|
1356
|
+
message: "Ids required",
|
|
1357
|
+
});
|
|
1346
1358
|
|
|
1347
1359
|
await this.#tenant.database.db?.collection(collection).updateMany(
|
|
1348
1360
|
{
|
|
@@ -1474,7 +1486,11 @@ class useRest {
|
|
|
1474
1486
|
});
|
|
1475
1487
|
return resolve(result!);
|
|
1476
1488
|
}
|
|
1477
|
-
if (!id)
|
|
1489
|
+
if (!id)
|
|
1490
|
+
return reject({
|
|
1491
|
+
code: 400,
|
|
1492
|
+
message: "Id required",
|
|
1493
|
+
});
|
|
1478
1494
|
|
|
1479
1495
|
let doc = await this.#tenant.database.db
|
|
1480
1496
|
?.collection(collection)
|
|
@@ -1585,7 +1601,11 @@ class useRest {
|
|
|
1585
1601
|
|
|
1586
1602
|
let deletedIds: any = ids || [];
|
|
1587
1603
|
|
|
1588
|
-
if (!ids)
|
|
1604
|
+
if (!ids)
|
|
1605
|
+
return reject({
|
|
1606
|
+
code: 400,
|
|
1607
|
+
message: "Ids required",
|
|
1608
|
+
});
|
|
1589
1609
|
|
|
1590
1610
|
if (Array.isArray(ids)) {
|
|
1591
1611
|
await this.#tenant.database.db?.collection(collection).deleteMany(
|
package/package.json
CHANGED