@timardex/cluemart-server-shared 1.0.206 → 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-BIHC7C72.mjs → chunk-3BUXU7KR.mjs} +73 -22
- package/dist/chunk-3BUXU7KR.mjs.map +1 -0
- package/dist/index.cjs +128 -21
- 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 +127 -21
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +67 -21
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +128 -21
- 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 +2 -2
- package/dist/chunk-BIHC7C72.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -721,6 +721,12 @@ type EventOrMarket = Pick<EventListItemType, "_id" | "name"> | null;
|
|
|
721
721
|
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id and name, or null if not found.
|
|
722
722
|
*/
|
|
723
723
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
724
|
+
/**
|
|
725
|
+
* Updates the dateStatus field for a single DateTimeType object based on the current date/time
|
|
726
|
+
* @param dateTime The date-time object to update
|
|
727
|
+
* @returns A new object with updated dateStatus value
|
|
728
|
+
*/
|
|
729
|
+
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T): T;
|
|
724
730
|
|
|
725
731
|
type EventDateSlot = Pick<DateTimeType$1, "startDate" | "startTime">;
|
|
726
732
|
/**
|
|
@@ -734,4 +740,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
734
740
|
*/
|
|
735
741
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
736
742
|
|
|
737
|
-
export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateRelationDatesToUnavailable, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
743
|
+
export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -721,6 +721,12 @@ type EventOrMarket = Pick<EventListItemType, "_id" | "name"> | null;
|
|
|
721
721
|
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id and name, or null if not found.
|
|
722
722
|
*/
|
|
723
723
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
724
|
+
/**
|
|
725
|
+
* Updates the dateStatus field for a single DateTimeType object based on the current date/time
|
|
726
|
+
* @param dateTime The date-time object to update
|
|
727
|
+
* @returns A new object with updated dateStatus value
|
|
728
|
+
*/
|
|
729
|
+
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T): T;
|
|
724
730
|
|
|
725
731
|
type EventDateSlot = Pick<DateTimeType$1, "startDate" | "startTime">;
|
|
726
732
|
/**
|
|
@@ -734,4 +740,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
734
740
|
*/
|
|
735
741
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
736
742
|
|
|
737
|
-
export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateRelationDatesToUnavailable, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
743
|
+
export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -3372,6 +3372,12 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
|
|
|
3372
3372
|
EnumSubscriptionStatus22["TRIALING"] = "trialing";
|
|
3373
3373
|
return EnumSubscriptionStatus22;
|
|
3374
3374
|
})(EnumSubscriptionStatus || {});
|
|
3375
|
+
var EnumReward = /* @__PURE__ */ ((EnumReward22) => {
|
|
3376
|
+
EnumReward22["MYSTERY_JOY_BOX"] = "mystery_joy_box";
|
|
3377
|
+
EnumReward22["MYSTERY_SQUEEZE_BOX"] = "mystery_squeeze_box";
|
|
3378
|
+
EnumReward22["MYSTERY_DELUXE_BOX"] = "mystery_deluxe_box";
|
|
3379
|
+
return EnumReward22;
|
|
3380
|
+
})(EnumReward || {});
|
|
3375
3381
|
var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
|
|
3376
3382
|
var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
|
|
3377
3383
|
var gameScreenIdentifierList = [
|
|
@@ -3471,6 +3477,8 @@ var gameScreenIdentifierList = [
|
|
|
3471
3477
|
match: "/visitors"
|
|
3472
3478
|
}
|
|
3473
3479
|
];
|
|
3480
|
+
var dateFormat = "DD-MM-YYYY";
|
|
3481
|
+
var timeFormat = "HH:mm";
|
|
3474
3482
|
dayjs.extend(customParseFormat);
|
|
3475
3483
|
dayjs.extend(utc);
|
|
3476
3484
|
dayjs.extend(timezone);
|
|
@@ -4836,6 +4844,26 @@ var DATETIME_FIELDS_FRAGMENT = gql`
|
|
|
4836
4844
|
startTime
|
|
4837
4845
|
}
|
|
4838
4846
|
`;
|
|
4847
|
+
var LOCATION_GEO_FIELDS_FRAGMENT = gql`
|
|
4848
|
+
fragment LocationGeoFields on LocationGeoType {
|
|
4849
|
+
coordinates
|
|
4850
|
+
type
|
|
4851
|
+
}
|
|
4852
|
+
`;
|
|
4853
|
+
var LOCATION_FIELDS_FRAGMENT = gql`
|
|
4854
|
+
fragment LocationFields on LocationType {
|
|
4855
|
+
city
|
|
4856
|
+
country
|
|
4857
|
+
fullAddress
|
|
4858
|
+
geo {
|
|
4859
|
+
...LocationGeoFields
|
|
4860
|
+
}
|
|
4861
|
+
latitude
|
|
4862
|
+
longitude
|
|
4863
|
+
region
|
|
4864
|
+
}
|
|
4865
|
+
${LOCATION_GEO_FIELDS_FRAGMENT}
|
|
4866
|
+
`;
|
|
4839
4867
|
var USER_ACTIVITY_FIELDS_FRAGMENT = gql`
|
|
4840
4868
|
fragment UserActivityFields on UserActivityType {
|
|
4841
4869
|
favourites {
|
|
@@ -4870,6 +4898,13 @@ var USER_ACTIVITY_FIELDS_FRAGMENT = gql`
|
|
|
4870
4898
|
}
|
|
4871
4899
|
${DATETIME_FIELDS_FRAGMENT}
|
|
4872
4900
|
`;
|
|
4901
|
+
var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
|
|
4902
|
+
fragment RedeemedRewardFields on RedeemedRewardType {
|
|
4903
|
+
name
|
|
4904
|
+
pointsUsed
|
|
4905
|
+
redeemedAt
|
|
4906
|
+
}
|
|
4907
|
+
`;
|
|
4873
4908
|
var USER_FIELDS_FRAGMENT = gql`
|
|
4874
4909
|
fragment UserFields on UserType {
|
|
4875
4910
|
_id
|
|
@@ -4891,12 +4926,18 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
4891
4926
|
licences {
|
|
4892
4927
|
...LicenceFields
|
|
4893
4928
|
}
|
|
4929
|
+
location {
|
|
4930
|
+
...LocationFields
|
|
4931
|
+
}
|
|
4894
4932
|
partner
|
|
4895
4933
|
overallPoints
|
|
4896
4934
|
platform
|
|
4897
4935
|
preferredRegion
|
|
4898
4936
|
promoCodes
|
|
4899
4937
|
role
|
|
4938
|
+
redeemedRewards {
|
|
4939
|
+
...RedeemedRewardFields
|
|
4940
|
+
}
|
|
4900
4941
|
school
|
|
4901
4942
|
termsAgreement {
|
|
4902
4943
|
...TermsAgreementFields
|
|
@@ -4912,6 +4953,8 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
4912
4953
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
4913
4954
|
${USER_ACTIVITY_FIELDS_FRAGMENT}
|
|
4914
4955
|
${LICENCE_FIELDS_FRAGMENT}
|
|
4956
|
+
${LOCATION_FIELDS_FRAGMENT}
|
|
4957
|
+
${REDEEMED_REWARD_FIELDS_FRAGMENT}
|
|
4915
4958
|
`;
|
|
4916
4959
|
var STALL_TYPE_FIELDS_FRAGMENT = gql`
|
|
4917
4960
|
fragment StallTypeFields on StallTypeType {
|
|
@@ -4948,26 +4991,6 @@ var CONTACT_DETAILS_FIELDS_FRAGMENT = gql`
|
|
|
4948
4991
|
mobilePhone
|
|
4949
4992
|
}
|
|
4950
4993
|
`;
|
|
4951
|
-
var LOCATION_GEO_FIELDS_FRAGMENT = gql`
|
|
4952
|
-
fragment LocationGeoFields on LocationGeoType {
|
|
4953
|
-
coordinates
|
|
4954
|
-
type
|
|
4955
|
-
}
|
|
4956
|
-
`;
|
|
4957
|
-
var LOCATION_FIELDS_FRAGMENT = gql`
|
|
4958
|
-
fragment LocationFields on LocationType {
|
|
4959
|
-
city
|
|
4960
|
-
country
|
|
4961
|
-
fullAddress
|
|
4962
|
-
geo {
|
|
4963
|
-
...LocationGeoFields
|
|
4964
|
-
}
|
|
4965
|
-
latitude
|
|
4966
|
-
longitude
|
|
4967
|
-
region
|
|
4968
|
-
}
|
|
4969
|
-
${LOCATION_GEO_FIELDS_FRAGMENT}
|
|
4970
|
-
`;
|
|
4971
4994
|
var EVENT_LIST_ITEM = gql`
|
|
4972
4995
|
fragment EventListItemFields on EventListItemType {
|
|
4973
4996
|
_id
|
|
@@ -6160,6 +6183,14 @@ var DELETE_USER_MUTATION = gql`
|
|
|
6160
6183
|
deleteUser(email: $email)
|
|
6161
6184
|
}
|
|
6162
6185
|
`;
|
|
6186
|
+
var REDEEM_REWARD_MUTATION = gql`
|
|
6187
|
+
mutation redeemReward($input: RedeemRewardInputType!) {
|
|
6188
|
+
redeemReward(input: $input) {
|
|
6189
|
+
message
|
|
6190
|
+
userId
|
|
6191
|
+
}
|
|
6192
|
+
}
|
|
6193
|
+
`;
|
|
6163
6194
|
var ADD_USER_FAVOURITE_RESOURCE_MUTATION = gql`
|
|
6164
6195
|
mutation addUserFavouriteResource(
|
|
6165
6196
|
$resourceId: ID!
|
|
@@ -6867,6 +6898,7 @@ var UPDATE_PUZZLE_GAME_MUTATION = gql`
|
|
|
6867
6898
|
var SCHOOL_REGISTERED_USERS_FIELDS_FRAGMENT = gql`
|
|
6868
6899
|
fragment SchoolRegisteredUsersFields on SchoolRegisteredUserType {
|
|
6869
6900
|
_id
|
|
6901
|
+
active
|
|
6870
6902
|
avatar {
|
|
6871
6903
|
...ResourceImageFields
|
|
6872
6904
|
}
|
|
@@ -7866,7 +7898,7 @@ schema4.index({ isRead: 1, userId: 1 });
|
|
|
7866
7898
|
schema4.index({ createdAt: -1, userId: 1 });
|
|
7867
7899
|
var NotificationModel = mongoose8.models.Notification || mongoose8.model("Notification", schema4);
|
|
7868
7900
|
|
|
7869
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7901
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-6B75Q67V.mjs
|
|
7870
7902
|
var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
|
|
7871
7903
|
EnumOSPlatform22["ANDROID"] = "android";
|
|
7872
7904
|
EnumOSPlatform22["IOS"] = "ios";
|
|
@@ -8007,6 +8039,18 @@ var stripeSchema = new MongooseSchema11(
|
|
|
8007
8039
|
},
|
|
8008
8040
|
{ _id: false }
|
|
8009
8041
|
);
|
|
8042
|
+
var redeemedRewardSchema = new MongooseSchema11(
|
|
8043
|
+
{
|
|
8044
|
+
name: {
|
|
8045
|
+
enum: Object.values(EnumReward),
|
|
8046
|
+
required: true,
|
|
8047
|
+
type: String
|
|
8048
|
+
},
|
|
8049
|
+
pointsUsed: { required: true, type: Number },
|
|
8050
|
+
redeemedAt: { required: true, type: Date }
|
|
8051
|
+
},
|
|
8052
|
+
{ _id: false }
|
|
8053
|
+
);
|
|
8010
8054
|
var schema7 = new MongooseSchema11(
|
|
8011
8055
|
{
|
|
8012
8056
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -8061,6 +8105,10 @@ var schema7 = new MongooseSchema11(
|
|
|
8061
8105
|
required: false,
|
|
8062
8106
|
type: [String]
|
|
8063
8107
|
},
|
|
8108
|
+
redeemedRewards: {
|
|
8109
|
+
required: false,
|
|
8110
|
+
type: [redeemedRewardSchema]
|
|
8111
|
+
},
|
|
8064
8112
|
refreshToken: {
|
|
8065
8113
|
required: false,
|
|
8066
8114
|
type: String
|
|
@@ -9040,6 +9088,15 @@ function convertObjectIdsToStrings(obj) {
|
|
|
9040
9088
|
}
|
|
9041
9089
|
|
|
9042
9090
|
// src/service/event.ts
|
|
9091
|
+
import dayjs2 from "dayjs";
|
|
9092
|
+
import customParseFormat2 from "dayjs/plugin/customParseFormat";
|
|
9093
|
+
import isoWeek from "dayjs/plugin/isoWeek";
|
|
9094
|
+
import isToday from "dayjs/plugin/isToday";
|
|
9095
|
+
import isTomorrow from "dayjs/plugin/isTomorrow";
|
|
9096
|
+
dayjs2.extend(customParseFormat2);
|
|
9097
|
+
dayjs2.extend(isToday);
|
|
9098
|
+
dayjs2.extend(isTomorrow);
|
|
9099
|
+
dayjs2.extend(isoWeek);
|
|
9043
9100
|
async function findEventOrImportedMarketById(resourceId) {
|
|
9044
9101
|
if (!resourceId) {
|
|
9045
9102
|
return null;
|
|
@@ -9051,6 +9108,54 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
9051
9108
|
]);
|
|
9052
9109
|
return eventDoc ?? googleImportedDoc;
|
|
9053
9110
|
}
|
|
9111
|
+
function getFutureEventStatus(startDateTime, now) {
|
|
9112
|
+
if (startDateTime.isToday()) {
|
|
9113
|
+
return EnumEventDateStatus.TODAY;
|
|
9114
|
+
}
|
|
9115
|
+
if (startDateTime.isTomorrow()) {
|
|
9116
|
+
return EnumEventDateStatus.TOMORROW;
|
|
9117
|
+
}
|
|
9118
|
+
if (startDateTime.isSame(now, "isoWeek")) {
|
|
9119
|
+
return EnumEventDateStatus.THIS_WEEK;
|
|
9120
|
+
}
|
|
9121
|
+
if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
|
|
9122
|
+
return EnumEventDateStatus.NEXT_WEEK;
|
|
9123
|
+
}
|
|
9124
|
+
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
9125
|
+
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
9126
|
+
return EnumEventDateStatus.STARTING_SOON;
|
|
9127
|
+
}
|
|
9128
|
+
return EnumEventDateStatus.UPCOMING;
|
|
9129
|
+
}
|
|
9130
|
+
function updateSingleDateTimeStatus(dateTime) {
|
|
9131
|
+
const now = dayjs2();
|
|
9132
|
+
const startDateTime = dayjs2(
|
|
9133
|
+
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
9134
|
+
`${dateFormat} ${timeFormat}`
|
|
9135
|
+
);
|
|
9136
|
+
const endDateTime = dayjs2(
|
|
9137
|
+
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
9138
|
+
`${dateFormat} ${timeFormat}`
|
|
9139
|
+
);
|
|
9140
|
+
if (!startDateTime.isValid() || !endDateTime.isValid()) {
|
|
9141
|
+
return {
|
|
9142
|
+
...dateTime,
|
|
9143
|
+
dateStatus: null
|
|
9144
|
+
};
|
|
9145
|
+
}
|
|
9146
|
+
let dateStatus = null;
|
|
9147
|
+
if (endDateTime.isBefore(now)) {
|
|
9148
|
+
dateStatus = EnumEventDateStatus.ENDED;
|
|
9149
|
+
} else if (startDateTime.isBefore(now) && endDateTime.isAfter(now)) {
|
|
9150
|
+
dateStatus = EnumEventDateStatus.STARTED;
|
|
9151
|
+
} else {
|
|
9152
|
+
dateStatus = getFutureEventStatus(startDateTime, now);
|
|
9153
|
+
}
|
|
9154
|
+
return {
|
|
9155
|
+
...dateTime,
|
|
9156
|
+
dateStatus
|
|
9157
|
+
};
|
|
9158
|
+
}
|
|
9054
9159
|
|
|
9055
9160
|
// src/service/relations.ts
|
|
9056
9161
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
@@ -9134,6 +9239,7 @@ export {
|
|
|
9134
9239
|
termsAgreementSchema,
|
|
9135
9240
|
updateAdStatuses,
|
|
9136
9241
|
updateRelationDatesToUnavailable,
|
|
9242
|
+
updateSingleDateTimeStatus,
|
|
9137
9243
|
updateVendorBasedOnUserLicense,
|
|
9138
9244
|
userLicenseSchema
|
|
9139
9245
|
};
|