@timardex/cluemart-server-shared 2.0.1 → 2.0.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.
@@ -169,14 +169,17 @@ declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T,
169
169
  */
170
170
  declare function updateAllEventDateTimeStatuses(): Promise<void>;
171
171
 
172
- type EventOrMarket = Pick<EventListItemType, "_id" | "name" | "dateTime"> | null;
172
+ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
173
+ /** Present on owned EventModel docs; absent on Google-imported markets. */
174
+ owner?: SchemaOwnerType;
175
+ }) | null;
173
176
  /**
174
177
  * This function attempts to find an Event or a Google Imported Market by the given resource ID.
175
178
  * It first normalizes the resource ID to a string format, then performs parallel queries to both collections.
176
179
  * If an Event is found, it returns that; otherwise, it checks for a Google Imported Market and returns it if found.
177
180
  * If neither is found, it returns null.
178
181
  * @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
179
- * @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, and dateTime, or null if not found.
182
+ * @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, dateTime, and owner (events only), or null if not found.
180
183
  */
181
184
  declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
182
185
 
@@ -169,14 +169,17 @@ declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T,
169
169
  */
170
170
  declare function updateAllEventDateTimeStatuses(): Promise<void>;
171
171
 
172
- type EventOrMarket = Pick<EventListItemType, "_id" | "name" | "dateTime"> | null;
172
+ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
173
+ /** Present on owned EventModel docs; absent on Google-imported markets. */
174
+ owner?: SchemaOwnerType;
175
+ }) | null;
173
176
  /**
174
177
  * This function attempts to find an Event or a Google Imported Market by the given resource ID.
175
178
  * It first normalizes the resource ID to a string format, then performs parallel queries to both collections.
176
179
  * If an Event is found, it returns that; otherwise, it checks for a Google Imported Market and returns it if found.
177
180
  * If neither is found, it returns null.
178
181
  * @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
179
- * @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, and dateTime, or null if not found.
182
+ * @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, dateTime, and owner (events only), or null if not found.
180
183
  */
181
184
  declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
182
185
 
@@ -707,7 +707,7 @@ async function findEventOrImportedMarketById(resourceId) {
707
707
  }
708
708
  const normalizedId = convertObjectIdsToStrings(resourceId);
709
709
  const [eventDoc, googleImportedDoc] = await Promise.all([
710
- EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
710
+ EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
711
711
  GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
712
712
  ]);
713
713
  return eventDoc ?? googleImportedDoc;