@timardex/cluemart-server-shared 1.0.207 → 1.0.208
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-AZS3BEZ3.mjs → chunk-3BUXU7KR.mjs} +6 -1
- package/dist/{chunk-AZS3BEZ3.mjs.map → chunk-3BUXU7KR.mjs.map} +1 -1
- package/dist/index.cjs +61 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +60 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +61 -0
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +10 -4
- package/dist/service/index.d.ts +10 -4
- package/dist/service/index.mjs +63 -2
- package/dist/service/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(service_exports, {
|
|
|
38
38
|
sendPushNotifications: () => sendPushNotifications,
|
|
39
39
|
updateAdStatuses: () => updateAdStatuses,
|
|
40
40
|
updateRelationDatesToUnavailable: () => updateRelationDatesToUnavailable,
|
|
41
|
+
updateSingleDateTimeStatus: () => updateSingleDateTimeStatus,
|
|
41
42
|
updateVendorBasedOnUserLicense: () => updateVendorBasedOnUserLicense
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(service_exports);
|
|
@@ -3546,6 +3547,8 @@ var gameScreenIdentifierList = [
|
|
|
3546
3547
|
match: "/visitors"
|
|
3547
3548
|
}
|
|
3548
3549
|
];
|
|
3550
|
+
var dateFormat = "DD-MM-YYYY";
|
|
3551
|
+
var timeFormat = "HH:mm";
|
|
3549
3552
|
import_dayjs.default.extend(import_customParseFormat.default);
|
|
3550
3553
|
import_dayjs.default.extend(import_utc.default);
|
|
3551
3554
|
import_dayjs.default.extend(import_timezone.default);
|
|
@@ -9132,6 +9135,15 @@ function convertObjectIdsToStrings(obj) {
|
|
|
9132
9135
|
}
|
|
9133
9136
|
|
|
9134
9137
|
// src/service/event.ts
|
|
9138
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
9139
|
+
var import_customParseFormat2 = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
9140
|
+
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
9141
|
+
var import_isToday = __toESM(require("dayjs/plugin/isToday"));
|
|
9142
|
+
var import_isTomorrow = __toESM(require("dayjs/plugin/isTomorrow"));
|
|
9143
|
+
import_dayjs2.default.extend(import_customParseFormat2.default);
|
|
9144
|
+
import_dayjs2.default.extend(import_isToday.default);
|
|
9145
|
+
import_dayjs2.default.extend(import_isTomorrow.default);
|
|
9146
|
+
import_dayjs2.default.extend(import_isoWeek.default);
|
|
9135
9147
|
async function findEventOrImportedMarketById(resourceId) {
|
|
9136
9148
|
if (!resourceId) {
|
|
9137
9149
|
return null;
|
|
@@ -9143,6 +9155,54 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
9143
9155
|
]);
|
|
9144
9156
|
return eventDoc ?? googleImportedDoc;
|
|
9145
9157
|
}
|
|
9158
|
+
function getFutureEventStatus(startDateTime, now) {
|
|
9159
|
+
if (startDateTime.isToday()) {
|
|
9160
|
+
return EnumEventDateStatus.TODAY;
|
|
9161
|
+
}
|
|
9162
|
+
if (startDateTime.isTomorrow()) {
|
|
9163
|
+
return EnumEventDateStatus.TOMORROW;
|
|
9164
|
+
}
|
|
9165
|
+
if (startDateTime.isSame(now, "isoWeek")) {
|
|
9166
|
+
return EnumEventDateStatus.THIS_WEEK;
|
|
9167
|
+
}
|
|
9168
|
+
if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
|
|
9169
|
+
return EnumEventDateStatus.NEXT_WEEK;
|
|
9170
|
+
}
|
|
9171
|
+
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
9172
|
+
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
9173
|
+
return EnumEventDateStatus.STARTING_SOON;
|
|
9174
|
+
}
|
|
9175
|
+
return EnumEventDateStatus.UPCOMING;
|
|
9176
|
+
}
|
|
9177
|
+
function updateSingleDateTimeStatus(dateTime) {
|
|
9178
|
+
const now = (0, import_dayjs2.default)();
|
|
9179
|
+
const startDateTime = (0, import_dayjs2.default)(
|
|
9180
|
+
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
9181
|
+
`${dateFormat} ${timeFormat}`
|
|
9182
|
+
);
|
|
9183
|
+
const endDateTime = (0, import_dayjs2.default)(
|
|
9184
|
+
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
9185
|
+
`${dateFormat} ${timeFormat}`
|
|
9186
|
+
);
|
|
9187
|
+
if (!startDateTime.isValid() || !endDateTime.isValid()) {
|
|
9188
|
+
return {
|
|
9189
|
+
...dateTime,
|
|
9190
|
+
dateStatus: null
|
|
9191
|
+
};
|
|
9192
|
+
}
|
|
9193
|
+
let dateStatus = null;
|
|
9194
|
+
if (endDateTime.isBefore(now)) {
|
|
9195
|
+
dateStatus = EnumEventDateStatus.ENDED;
|
|
9196
|
+
} else if (startDateTime.isBefore(now) && endDateTime.isAfter(now)) {
|
|
9197
|
+
dateStatus = EnumEventDateStatus.STARTED;
|
|
9198
|
+
} else {
|
|
9199
|
+
dateStatus = getFutureEventStatus(startDateTime, now);
|
|
9200
|
+
}
|
|
9201
|
+
return {
|
|
9202
|
+
...dateTime,
|
|
9203
|
+
dateStatus
|
|
9204
|
+
};
|
|
9205
|
+
}
|
|
9146
9206
|
|
|
9147
9207
|
// src/service/relations.ts
|
|
9148
9208
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
@@ -9176,6 +9236,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
9176
9236
|
sendPushNotifications,
|
|
9177
9237
|
updateAdStatuses,
|
|
9178
9238
|
updateRelationDatesToUnavailable,
|
|
9239
|
+
updateSingleDateTimeStatus,
|
|
9179
9240
|
updateVendorBasedOnUserLicense
|
|
9180
9241
|
});
|
|
9181
9242
|
//# sourceMappingURL=index.cjs.map
|