@timardex/cluemart-server-shared 2.1.11 → 2.2.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.
@@ -160,9 +160,11 @@ declare function isValidObjectId(value: string): boolean;
160
160
  declare function convertObjectIdsToStrings(obj: any): any;
161
161
 
162
162
  /**
163
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time
163
+ * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
164
+ * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
164
165
  * @param dateTime The date-time object to update
165
- * @returns A new object with updated dateStatus value
166
+ * @returns A new object with an updated dateStatus value, or the original
167
+ * object when the stored status is a manual override
166
168
  */
167
169
  declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
168
170
  /**
@@ -160,9 +160,11 @@ declare function isValidObjectId(value: string): boolean;
160
160
  declare function convertObjectIdsToStrings(obj: any): any;
161
161
 
162
162
  /**
163
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time
163
+ * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
164
+ * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
164
165
  * @param dateTime The date-time object to update
165
- * @returns A new object with updated dateStatus value
166
+ * @returns A new object with an updated dateStatus value, or the original
167
+ * object when the stored status is a manual override
166
168
  */
167
169
  declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
168
170
  /**
@@ -667,6 +667,10 @@ async function persistArchivedEventDates(eventId, slots) {
667
667
  // src/service/event/updateAllEventDateTimeStatuses.ts
668
668
  dayjs2.extend(customParseFormat);
669
669
  dayjs2.extend(isoWeek);
670
+ var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
671
+ EnumEventDateStatus2.CANCELED,
672
+ EnumEventDateStatus2.RE_SCHEDULED
673
+ ]);
670
674
  function getFutureEventStatus(startDateTime, now) {
671
675
  const hoursUntilStart = startDateTime.diff(now, "hour", true);
672
676
  if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
@@ -687,6 +691,9 @@ function getFutureEventStatus(startDateTime, now) {
687
691
  return EnumEventDateStatus2.UPCOMING;
688
692
  }
689
693
  function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
694
+ if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
695
+ return dateTime;
696
+ }
690
697
  const dateTimeFormat = `${dateFormat} ${timeFormat}`;
691
698
  const startDateTime = dayjs2(
692
699
  `${dateTime.startDate} ${dateTime.startTime}`,