@timardex/cluemart-server-shared 3.0.2 → 4.0.0
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/{chunk-7JWQ7WKJ.mjs → chunk-MVQMMXGY.mjs} +353 -237
- package/dist/chunk-MVQMMXGY.mjs.map +1 -0
- package/dist/index.cjs +547 -427
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -7
- package/dist/index.d.ts +34 -7
- package/dist/index.mjs +369 -248
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +407 -292
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +28 -2
- package/dist/mongoose/index.d.ts +28 -2
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +542 -426
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +6 -5
- package/dist/service/index.d.ts +6 -5
- package/dist/service/index.mjs +12 -6
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-7JWQ7WKJ.mjs.map +0 -1
package/dist/service/index.d.mts
CHANGED
|
@@ -290,12 +290,13 @@ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
|
|
|
290
290
|
owner?: SchemaOwnerType;
|
|
291
291
|
}) | null;
|
|
292
292
|
/**
|
|
293
|
-
* This function attempts to find an Event
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* If
|
|
293
|
+
* This function attempts to find an Event, Google Imported Market, or AI
|
|
294
|
+
* Imported Market by the given resource ID.
|
|
295
|
+
* It first normalizes the resource ID to a string format, then performs parallel queries to all three collections.
|
|
296
|
+
* If an Event is found, it returns that; otherwise it checks the imported-market collections and returns the first match.
|
|
297
|
+
* If none is found, it returns null.
|
|
297
298
|
* @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
|
|
298
|
-
* @returns A promise that resolves to either an Event or
|
|
299
|
+
* @returns A promise that resolves to either an Event or an Imported Market object containing _id, name, dateTime, and owner (events only), or null if not found.
|
|
299
300
|
*/
|
|
300
301
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
301
302
|
|
package/dist/service/index.d.ts
CHANGED
|
@@ -290,12 +290,13 @@ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
|
|
|
290
290
|
owner?: SchemaOwnerType;
|
|
291
291
|
}) | null;
|
|
292
292
|
/**
|
|
293
|
-
* This function attempts to find an Event
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* If
|
|
293
|
+
* This function attempts to find an Event, Google Imported Market, or AI
|
|
294
|
+
* Imported Market by the given resource ID.
|
|
295
|
+
* It first normalizes the resource ID to a string format, then performs parallel queries to all three collections.
|
|
296
|
+
* If an Event is found, it returns that; otherwise it checks the imported-market collections and returns the first match.
|
|
297
|
+
* If none is found, it returns null.
|
|
297
298
|
* @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
|
|
298
|
-
* @returns A promise that resolves to either an Event or
|
|
299
|
+
* @returns A promise that resolves to either an Event or an Imported Market object containing _id, name, dateTime, and owner (events only), or null if not found.
|
|
299
300
|
*/
|
|
300
301
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
301
302
|
|
package/dist/service/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AdModel,
|
|
3
3
|
AffiliateModel,
|
|
4
|
+
AiImportedMarketModel,
|
|
4
5
|
EventDateArchiveModel,
|
|
5
6
|
EventInfoModel,
|
|
6
7
|
EventModel,
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
PushTokenModel,
|
|
11
12
|
UserModel,
|
|
12
13
|
VendorModel
|
|
13
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-MVQMMXGY.mjs";
|
|
14
15
|
import "../chunk-F54NB7VH.mjs";
|
|
15
16
|
|
|
16
17
|
// src/service/promoCode/constants.ts
|
|
@@ -1033,15 +1034,19 @@ async function cleanEventInfoDates(now) {
|
|
|
1033
1034
|
}
|
|
1034
1035
|
async function updateAllEventDateTimeStatuses() {
|
|
1035
1036
|
const now = dayjs4();
|
|
1036
|
-
const [eventCount, marketCount] = await Promise.all([
|
|
1037
|
+
const [eventCount, marketCount, aiMarketCount] = await Promise.all([
|
|
1037
1038
|
updateModelDateTimeStatuses(EventModel, now),
|
|
1038
1039
|
updateModelDateTimeStatuses(
|
|
1039
1040
|
GoogleImportedMarketModel,
|
|
1040
1041
|
now
|
|
1042
|
+
),
|
|
1043
|
+
updateModelDateTimeStatuses(
|
|
1044
|
+
AiImportedMarketModel,
|
|
1045
|
+
now
|
|
1041
1046
|
)
|
|
1042
1047
|
]);
|
|
1043
1048
|
console.log(
|
|
1044
|
-
`\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed`
|
|
1049
|
+
`\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed, ai imported markets=${aiMarketCount} changed`
|
|
1045
1050
|
);
|
|
1046
1051
|
const archivedCount = await archiveEndedAndDiscardInvalidEventDates(now);
|
|
1047
1052
|
if (archivedCount > 0) {
|
|
@@ -1064,11 +1069,12 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
1064
1069
|
return null;
|
|
1065
1070
|
}
|
|
1066
1071
|
const normalizedId = convertObjectIdsToStrings(resourceId);
|
|
1067
|
-
const [eventDoc, googleImportedDoc] = await Promise.all([
|
|
1072
|
+
const [eventDoc, googleImportedDoc, aiImportedDoc] = await Promise.all([
|
|
1068
1073
|
EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
|
|
1069
|
-
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
1074
|
+
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
|
|
1075
|
+
AiImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
1070
1076
|
]);
|
|
1071
|
-
return eventDoc ?? googleImportedDoc;
|
|
1077
|
+
return eventDoc ?? googleImportedDoc ?? aiImportedDoc;
|
|
1072
1078
|
}
|
|
1073
1079
|
|
|
1074
1080
|
// src/service/relations.ts
|