@7365admin1/core 3.32.2-staging.11 → 3.32.2-staging.12

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 CHANGED
@@ -7491,6 +7491,7 @@ declare function useChannelPrelovedRepo(): {
7491
7491
  pages: number;
7492
7492
  pageRange: string;
7493
7493
  }>;
7494
+ createIndexes: () => Promise<string>;
7494
7495
  };
7495
7496
 
7496
7497
  declare function useChannelPrelovedController(): {
package/dist/index.js CHANGED
@@ -68807,6 +68807,23 @@ function useChannelPrelovedRepo() {
68807
68807
  const CHANNEL_COLLECTION = "channel-preloved";
68808
68808
  const CHAT_COLLECTION = "chat-preloved";
68809
68809
  const collection = db.collection(CHANNEL_COLLECTION);
68810
+ async function createIndexes() {
68811
+ try {
68812
+ await collection.createIndexes([
68813
+ // getByParticipants: exact channel lookup by sender+receiver+post.
68814
+ // Its senderId prefix also serves the senderId branch of getChatLists' $or.
68815
+ { key: { senderId: 1, receiverId: 1, postId: 1 } },
68816
+ // getChatLists $or: the receiverId branch (senderId is covered by the
68817
+ // compound prefix above).
68818
+ { key: { receiverId: 1 } }
68819
+ ]);
68820
+ return `Successfully created indexes for ${CHANNEL_COLLECTION}.`;
68821
+ } catch (error) {
68822
+ throw new import_node_server_utils248.InternalServerError(
68823
+ "Failed to create indexes on channel-preloved."
68824
+ );
68825
+ }
68826
+ }
68810
68827
  async function add(value, session) {
68811
68828
  try {
68812
68829
  const doc = MChannelPreloved(value);
@@ -69025,7 +69042,13 @@ function useChannelPrelovedRepo() {
69025
69042
  throw error;
69026
69043
  }
69027
69044
  }
69028
- return { add, getByParticipants, getChatLists, getChannelMessages };
69045
+ return {
69046
+ add,
69047
+ getByParticipants,
69048
+ getChatLists,
69049
+ getChannelMessages,
69050
+ createIndexes
69051
+ };
69029
69052
  }
69030
69053
 
69031
69054
  // src/services/chat-preloved.service.ts