@7365admin1/core 3.32.2-staging.5 → 3.32.2-staging.6
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/index.d.ts +1 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7296,6 +7296,7 @@ declare function usePostFavoriteRepo(): {
|
|
|
7296
7296
|
getById: (_id: string | ObjectId) => Promise<mongodb.WithId<TPostFavorite>>;
|
|
7297
7297
|
getByPostId: (postId: string | ObjectId) => Promise<mongodb.WithId<TPostFavorite>>;
|
|
7298
7298
|
updateById: (_id: string | ObjectId, userId: string | ObjectId, session?: any) => Promise<"removed" | "added">;
|
|
7299
|
+
createIndexes: () => Promise<string>;
|
|
7299
7300
|
};
|
|
7300
7301
|
|
|
7301
7302
|
declare function usePostFavoriteService(): {
|
package/dist/index.js
CHANGED
|
@@ -67502,6 +67502,16 @@ function usePostFavoriteRepo() {
|
|
|
67502
67502
|
}
|
|
67503
67503
|
const FAVORITE_COLLECTION = "post-favorites";
|
|
67504
67504
|
const collection = db.collection(FAVORITE_COLLECTION);
|
|
67505
|
+
async function createIndexes() {
|
|
67506
|
+
try {
|
|
67507
|
+
await collection.createIndexes([{ key: { postId: 1 }, unique: true }]);
|
|
67508
|
+
return `Successfully created indexes for ${FAVORITE_COLLECTION}.`;
|
|
67509
|
+
} catch (error) {
|
|
67510
|
+
throw new import_node_server_utils238.InternalServerError(
|
|
67511
|
+
"Failed to create indexes on post-favorites."
|
|
67512
|
+
);
|
|
67513
|
+
}
|
|
67514
|
+
}
|
|
67505
67515
|
async function addFavorite(value, session) {
|
|
67506
67516
|
try {
|
|
67507
67517
|
const doc = MPostFavorite(value);
|
|
@@ -67570,7 +67580,8 @@ function usePostFavoriteRepo() {
|
|
|
67570
67580
|
addFavorite,
|
|
67571
67581
|
getById,
|
|
67572
67582
|
getByPostId,
|
|
67573
|
-
updateById
|
|
67583
|
+
updateById,
|
|
67584
|
+
createIndexes
|
|
67574
67585
|
};
|
|
67575
67586
|
}
|
|
67576
67587
|
|