@eeplatform/core 1.2.0 → 1.2.1
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +13 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2489,8 +2489,7 @@ declare function MBuildingUnit(value: TBuildingUnit): {
|
|
|
2489
2489
|
};
|
|
2490
2490
|
|
|
2491
2491
|
declare function useBuildingRepo(): {
|
|
2492
|
-
|
|
2493
|
-
createTextIndex: () => Promise<void>;
|
|
2492
|
+
createIndexes: () => Promise<void>;
|
|
2494
2493
|
add: (value: TBuilding, session?: ClientSession) => Promise<ObjectId>;
|
|
2495
2494
|
getAll: ({ search, page, limit, sort, school, status, }?: {
|
|
2496
2495
|
search?: string | undefined;
|
|
@@ -2510,7 +2509,7 @@ declare function useBuildingRepo(): {
|
|
|
2510
2509
|
};
|
|
2511
2510
|
|
|
2512
2511
|
declare function useBuildingUnitRepo(): {
|
|
2513
|
-
|
|
2512
|
+
createIndexes: () => Promise<void>;
|
|
2514
2513
|
add: (value: TBuildingUnit, session?: ClientSession) => Promise<ObjectId>;
|
|
2515
2514
|
getAll: ({ search, page, limit, sort, school, building, status, }?: {
|
|
2516
2515
|
search?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -27083,26 +27083,17 @@ function useBuildingRepo() {
|
|
|
27083
27083
|
const namespace_collection = "school.buildings";
|
|
27084
27084
|
const collection = db.collection(namespace_collection);
|
|
27085
27085
|
const { getCache, setCache, delNamespace } = (0, import_nodejs_utils67.useCache)(namespace_collection);
|
|
27086
|
-
async function
|
|
27086
|
+
async function createIndexes() {
|
|
27087
27087
|
try {
|
|
27088
|
-
await collection.
|
|
27089
|
-
{ name: 1 },
|
|
27090
|
-
{ school: 1 },
|
|
27091
|
-
{
|
|
27088
|
+
await collection.createIndexes([
|
|
27089
|
+
{ key: { name: 1 }, unique: true, name: "unique_name_index" },
|
|
27090
|
+
{ key: { school: 1 } },
|
|
27091
|
+
{ key: { status: 1 } }
|
|
27092
27092
|
]);
|
|
27093
27093
|
} catch (error) {
|
|
27094
27094
|
throw new Error("Failed to create index on buildings.");
|
|
27095
27095
|
}
|
|
27096
27096
|
}
|
|
27097
|
-
async function createTextIndex() {
|
|
27098
|
-
try {
|
|
27099
|
-
await collection.createIndex({
|
|
27100
|
-
name: "text"
|
|
27101
|
-
});
|
|
27102
|
-
} catch (error) {
|
|
27103
|
-
throw new Error("Failed to create text index on building name.");
|
|
27104
|
-
}
|
|
27105
|
-
}
|
|
27106
27097
|
async function add(value, session) {
|
|
27107
27098
|
try {
|
|
27108
27099
|
value = MBuilding(value);
|
|
@@ -27302,8 +27293,7 @@ function useBuildingRepo() {
|
|
|
27302
27293
|
});
|
|
27303
27294
|
}
|
|
27304
27295
|
return {
|
|
27305
|
-
|
|
27306
|
-
createTextIndex,
|
|
27296
|
+
createIndexes,
|
|
27307
27297
|
add,
|
|
27308
27298
|
getAll,
|
|
27309
27299
|
getById,
|
|
@@ -27323,9 +27313,14 @@ function useBuildingUnitRepo() {
|
|
|
27323
27313
|
const namespace_collection = "school.building-units";
|
|
27324
27314
|
const collection = db.collection(namespace_collection);
|
|
27325
27315
|
const { getCache, setCache, delNamespace } = (0, import_nodejs_utils68.useCache)(namespace_collection);
|
|
27326
|
-
async function
|
|
27316
|
+
async function createIndexes() {
|
|
27327
27317
|
try {
|
|
27328
27318
|
await collection.createIndexes([
|
|
27319
|
+
{
|
|
27320
|
+
key: { name: 1, building: 1, level: 1 },
|
|
27321
|
+
unique: true,
|
|
27322
|
+
name: "unique_name_index"
|
|
27323
|
+
},
|
|
27329
27324
|
{ key: { school: 1 } },
|
|
27330
27325
|
{ key: { building: 1 } },
|
|
27331
27326
|
{ key: { status: 1 } },
|
|
@@ -27644,7 +27639,7 @@ function useBuildingUnitRepo() {
|
|
|
27644
27639
|
}
|
|
27645
27640
|
}
|
|
27646
27641
|
return {
|
|
27647
|
-
|
|
27642
|
+
createIndexes,
|
|
27648
27643
|
add,
|
|
27649
27644
|
getAll,
|
|
27650
27645
|
getById,
|