@timardex/cluemart-server-shared 1.0.287 → 1.0.291
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/{Affiliate-CmS0A1gU.d.mts → Affiliate-6XcZ131C.d.mts} +22 -10
- package/dist/{Affiliate-C_g6TdeG.d.ts → Affiliate-DCvdeKW7.d.ts} +22 -10
- package/dist/{chunk-6EDO734D.mjs → chunk-IGEC5D7N.mjs} +73 -45
- package/dist/chunk-IGEC5D7N.mjs.map +1 -0
- package/dist/chunk-YXUJ4VQU.mjs +17 -0
- package/dist/chunk-YXUJ4VQU.mjs.map +1 -0
- package/dist/index.cjs +134 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +41 -11
- package/dist/index.d.ts +41 -11
- package/dist/index.mjs +132 -59
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +71 -43
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +2 -2
- package/dist/mongoose/index.d.ts +2 -2
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +126 -47
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +21 -3
- package/dist/service/index.d.ts +21 -3
- package/dist/service/index.mjs +47 -1
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.mjs +5 -10
- package/dist/types/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6EDO734D.mjs.map +0 -1
|
@@ -3,8 +3,8 @@ import { AdType, ReportChatUser, GoogleImportedMarket, PushTokenType, ResourceAc
|
|
|
3
3
|
import mongoose__default from 'mongoose';
|
|
4
4
|
import { O as ObjectId } from '../Chat-Bnqec74U.mjs';
|
|
5
5
|
export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-Bnqec74U.mjs';
|
|
6
|
-
import { S as SchemaOwnerType } from '../Affiliate-
|
|
7
|
-
export { A as AffiliateModel, C as CategorySchema, d as ContactDetailsSchema, O as OwnerTypeSchema, m as RelationModel, k as RelationTypeSchema, R as ResourceImageTypeSchema, o as SchemaAffiliateResourceType, n as SchemaAffiliateReward, a as SchemaRelatedPostType, j as SchemaRelationType, b as SocialMediaTypeSchema, c as associatesSchema, h as baseResourceFields, e as dateTimeSchema, l as locationGeoSchema, f as locationsSchema, g as relatedPostSchema, i as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-
|
|
6
|
+
import { S as SchemaOwnerType } from '../Affiliate-6XcZ131C.mjs';
|
|
7
|
+
export { A as AffiliateModel, C as CategorySchema, d as ContactDetailsSchema, O as OwnerTypeSchema, m as RelationModel, k as RelationTypeSchema, R as ResourceImageTypeSchema, o as SchemaAffiliateResourceType, n as SchemaAffiliateReward, a as SchemaRelatedPostType, j as SchemaRelationType, b as SocialMediaTypeSchema, c as associatesSchema, h as baseResourceFields, e as dateTimeSchema, l as locationGeoSchema, f as locationsSchema, g as relatedPostSchema, i as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-6XcZ131C.mjs';
|
|
8
8
|
import '@timardex/cluemart-shared/types';
|
|
9
9
|
import 'express';
|
|
10
10
|
|
package/dist/mongoose/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { AdType, ReportChatUser, GoogleImportedMarket, PushTokenType, ResourceAc
|
|
|
3
3
|
import mongoose__default from 'mongoose';
|
|
4
4
|
import { O as ObjectId } from '../Chat-Bnqec74U.js';
|
|
5
5
|
export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-Bnqec74U.js';
|
|
6
|
-
import { S as SchemaOwnerType } from '../Affiliate-
|
|
7
|
-
export { A as AffiliateModel, C as CategorySchema, d as ContactDetailsSchema, O as OwnerTypeSchema, m as RelationModel, k as RelationTypeSchema, R as ResourceImageTypeSchema, o as SchemaAffiliateResourceType, n as SchemaAffiliateReward, a as SchemaRelatedPostType, j as SchemaRelationType, b as SocialMediaTypeSchema, c as associatesSchema, h as baseResourceFields, e as dateTimeSchema, l as locationGeoSchema, f as locationsSchema, g as relatedPostSchema, i as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-
|
|
6
|
+
import { S as SchemaOwnerType } from '../Affiliate-DCvdeKW7.js';
|
|
7
|
+
export { A as AffiliateModel, C as CategorySchema, d as ContactDetailsSchema, O as OwnerTypeSchema, m as RelationModel, k as RelationTypeSchema, R as ResourceImageTypeSchema, o as SchemaAffiliateResourceType, n as SchemaAffiliateReward, a as SchemaRelatedPostType, j as SchemaRelationType, b as SocialMediaTypeSchema, c as associatesSchema, h as baseResourceFields, e as dateTimeSchema, l as locationGeoSchema, f as locationsSchema, g as relatedPostSchema, i as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-DCvdeKW7.js';
|
|
8
8
|
import '@timardex/cluemart-shared/types';
|
|
9
9
|
import 'express';
|
|
10
10
|
|
package/dist/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -44,6 +44,8 @@ __export(service_exports, {
|
|
|
44
44
|
mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
|
|
45
45
|
normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
|
|
46
46
|
normalizePromoCode: () => normalizePromoCode,
|
|
47
|
+
notifyUsers: () => notifyUsers,
|
|
48
|
+
publishNotificationEvents: () => publishNotificationEvents,
|
|
47
49
|
saveNotificationsInDb: () => saveNotificationsInDb,
|
|
48
50
|
sendPushNotifications: () => sendPushNotifications,
|
|
49
51
|
updateAdStatuses: () => updateAdStatuses,
|
|
@@ -4710,29 +4712,6 @@ var tagOptions = availableTagTypes.map((tag) => ({
|
|
|
4710
4712
|
label: tag.label,
|
|
4711
4713
|
value: tag.label
|
|
4712
4714
|
}));
|
|
4713
|
-
var stallTypes = [
|
|
4714
|
-
"1.8m table only",
|
|
4715
|
-
"2x2m mini stall",
|
|
4716
|
-
"3x3m tent site",
|
|
4717
|
-
"Corner stall",
|
|
4718
|
-
"Craft stall with power",
|
|
4719
|
-
"Craft stall without power",
|
|
4720
|
-
"Double stall (6x3m)",
|
|
4721
|
-
"Food truck site",
|
|
4722
|
-
"Food vendor with power",
|
|
4723
|
-
"Food vendor without power",
|
|
4724
|
-
"Inside hall stall",
|
|
4725
|
-
"Non-profit/community stall",
|
|
4726
|
-
"Outdoor open area",
|
|
4727
|
-
"Shared table space",
|
|
4728
|
-
"Wall-based vendor",
|
|
4729
|
-
"Workshop/seating area"
|
|
4730
|
-
];
|
|
4731
|
-
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4732
|
-
label: type,
|
|
4733
|
-
price: 0,
|
|
4734
|
-
stallCapacity: 0
|
|
4735
|
-
}));
|
|
4736
4715
|
var emailField = {
|
|
4737
4716
|
helperText: "Enter email address",
|
|
4738
4717
|
keyboardType: "email-address",
|
|
@@ -4757,6 +4736,51 @@ var companyContactFields = [
|
|
|
4757
4736
|
placeholder: "Landline Phone Number"
|
|
4758
4737
|
}
|
|
4759
4738
|
];
|
|
4739
|
+
var bankAccountDetailsFields = [
|
|
4740
|
+
{
|
|
4741
|
+
helperText: "Account holder name *",
|
|
4742
|
+
name: "accountHolderName",
|
|
4743
|
+
placeholder: "Account holder name"
|
|
4744
|
+
},
|
|
4745
|
+
{
|
|
4746
|
+
helperText: "Account number *",
|
|
4747
|
+
keyboardType: "number-pad",
|
|
4748
|
+
name: "accountNumber",
|
|
4749
|
+
placeholder: "Account number"
|
|
4750
|
+
}
|
|
4751
|
+
];
|
|
4752
|
+
var eventInfoPaymentInfo = [
|
|
4753
|
+
...bankAccountDetailsFields,
|
|
4754
|
+
{
|
|
4755
|
+
helperText: "Payment link, where applicants can pay *",
|
|
4756
|
+
keyboardType: "url",
|
|
4757
|
+
name: "link",
|
|
4758
|
+
placeholder: "Payment link"
|
|
4759
|
+
}
|
|
4760
|
+
];
|
|
4761
|
+
var stallTypes = [
|
|
4762
|
+
"1.8m table only",
|
|
4763
|
+
"2x2m mini stall",
|
|
4764
|
+
"3x3m tent site",
|
|
4765
|
+
"Corner stall",
|
|
4766
|
+
"Craft stall with power",
|
|
4767
|
+
"Craft stall without power",
|
|
4768
|
+
"Double stall (6x3m)",
|
|
4769
|
+
"Food truck site",
|
|
4770
|
+
"Food vendor with power",
|
|
4771
|
+
"Food vendor without power",
|
|
4772
|
+
"Inside hall stall",
|
|
4773
|
+
"Non-profit/community stall",
|
|
4774
|
+
"Outdoor open area",
|
|
4775
|
+
"Shared table space",
|
|
4776
|
+
"Wall-based vendor",
|
|
4777
|
+
"Workshop/seating area"
|
|
4778
|
+
];
|
|
4779
|
+
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4780
|
+
label: type,
|
|
4781
|
+
price: 0,
|
|
4782
|
+
stallCapacity: 0
|
|
4783
|
+
}));
|
|
4760
4784
|
var loginFields = [
|
|
4761
4785
|
{
|
|
4762
4786
|
...emailField,
|
|
@@ -7528,8 +7552,10 @@ var AFFILIATE_FIELDS_FRAGMENT = gql`
|
|
|
7528
7552
|
}
|
|
7529
7553
|
createdAt
|
|
7530
7554
|
deletedAt
|
|
7531
|
-
|
|
7532
|
-
|
|
7555
|
+
redeemHistory {
|
|
7556
|
+
redeemedAt
|
|
7557
|
+
rewardValue
|
|
7558
|
+
}
|
|
7533
7559
|
overallPoints
|
|
7534
7560
|
owner {
|
|
7535
7561
|
...OwnerFields
|
|
@@ -8235,6 +8261,14 @@ var relatedPostSchema = new MongooseSchema6(
|
|
|
8235
8261
|
{ _id: false }
|
|
8236
8262
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8237
8263
|
);
|
|
8264
|
+
var socialShareResourceSchema = new MongooseSchema6(
|
|
8265
|
+
{
|
|
8266
|
+
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
8267
|
+
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
8268
|
+
},
|
|
8269
|
+
{ _id: false }
|
|
8270
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8271
|
+
);
|
|
8238
8272
|
var baseResourceFields = {
|
|
8239
8273
|
active: { default: false, required: true, type: Boolean },
|
|
8240
8274
|
adIds: {
|
|
@@ -8266,18 +8300,11 @@ var baseResourceFields = {
|
|
|
8266
8300
|
region: { required: true, type: String },
|
|
8267
8301
|
relatedPost: { required: false, type: relatedPostSchema },
|
|
8268
8302
|
reviewCount: { required: false, type: Number },
|
|
8303
|
+
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8269
8304
|
slug: { required: true, type: String },
|
|
8270
8305
|
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
8271
8306
|
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
8272
8307
|
};
|
|
8273
|
-
var socialShareResourceSchema = new MongooseSchema6(
|
|
8274
|
-
{
|
|
8275
|
-
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
8276
|
-
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
8277
|
-
},
|
|
8278
|
-
{ _id: false }
|
|
8279
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8280
|
-
);
|
|
8281
8308
|
|
|
8282
8309
|
// src/mongoose/GoogleImportedMarket.ts
|
|
8283
8310
|
var import_mongoose7 = __toESM(require("mongoose"));
|
|
@@ -8754,7 +8781,6 @@ var schema9 = new MongooseSchema13(
|
|
|
8754
8781
|
required: false,
|
|
8755
8782
|
type: [resourceRelationsSchema]
|
|
8756
8783
|
},
|
|
8757
|
-
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8758
8784
|
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
8759
8785
|
unregisteredVendorId: {
|
|
8760
8786
|
ref: "UnregisteredVendor",
|
|
@@ -8907,7 +8933,6 @@ var schema12 = new MongooseSchema16(
|
|
|
8907
8933
|
required: false,
|
|
8908
8934
|
type: [resourceRelationsSchema]
|
|
8909
8935
|
},
|
|
8910
|
-
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8911
8936
|
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
8912
8937
|
tags: { required: true, type: [String] }
|
|
8913
8938
|
},
|
|
@@ -8939,8 +8964,7 @@ var schema13 = new MongooseSchema17(
|
|
|
8939
8964
|
enum: Object.values(EnumPartnerType),
|
|
8940
8965
|
required: true,
|
|
8941
8966
|
type: String
|
|
8942
|
-
}
|
|
8943
|
-
sharePublic: { required: false, type: socialShareResourceSchema }
|
|
8967
|
+
}
|
|
8944
8968
|
},
|
|
8945
8969
|
{ timestamps: true }
|
|
8946
8970
|
);
|
|
@@ -9315,6 +9339,13 @@ var affiliateDetailsSchema = new MongooseSchema25(
|
|
|
9315
9339
|
},
|
|
9316
9340
|
{ _id: false }
|
|
9317
9341
|
);
|
|
9342
|
+
var redeemHistorySchema = new MongooseSchema25(
|
|
9343
|
+
{
|
|
9344
|
+
redeemedAt: { required: true, type: Date },
|
|
9345
|
+
rewardValue: { required: true, type: Number }
|
|
9346
|
+
},
|
|
9347
|
+
{ _id: false }
|
|
9348
|
+
);
|
|
9318
9349
|
var schema17 = new MongooseSchema25(
|
|
9319
9350
|
{
|
|
9320
9351
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -9331,16 +9362,15 @@ var schema17 = new MongooseSchema25(
|
|
|
9331
9362
|
type: [affiliateResourceSchema]
|
|
9332
9363
|
},
|
|
9333
9364
|
deletedAt: { default: null, required: false, type: Date },
|
|
9334
|
-
lastRewardRedemptionAt: { default: null, required: false, type: Date },
|
|
9335
|
-
lastRewardRedemptionPoints: {
|
|
9336
|
-
default: null,
|
|
9337
|
-
required: false,
|
|
9338
|
-
type: Number
|
|
9339
|
-
},
|
|
9340
9365
|
overallPoints: { default: 0, required: true, type: Number },
|
|
9341
9366
|
owner: {
|
|
9342
9367
|
required: true,
|
|
9343
9368
|
type: OwnerTypeSchema
|
|
9369
|
+
},
|
|
9370
|
+
redeemHistory: {
|
|
9371
|
+
default: [],
|
|
9372
|
+
required: false,
|
|
9373
|
+
type: [redeemHistorySchema]
|
|
9344
9374
|
}
|
|
9345
9375
|
},
|
|
9346
9376
|
{ timestamps: true }
|
|
@@ -9787,6 +9817,53 @@ var connectToDatabase = async ({
|
|
|
9787
9817
|
}
|
|
9788
9818
|
};
|
|
9789
9819
|
|
|
9820
|
+
// src/types/index.ts
|
|
9821
|
+
var import_express = __toESM(require("express"));
|
|
9822
|
+
var import_mongoose30 = __toESM(require("mongoose"));
|
|
9823
|
+
|
|
9824
|
+
// src/service/notifyUsers.ts
|
|
9825
|
+
async function publishNotificationEvents(userId, pubsub) {
|
|
9826
|
+
try {
|
|
9827
|
+
const userNotifications = await NotificationModel.find({
|
|
9828
|
+
userId
|
|
9829
|
+
}).sort({ createdAt: -1 });
|
|
9830
|
+
const [total, unread] = await Promise.all([
|
|
9831
|
+
NotificationModel.countDocuments({ userId }),
|
|
9832
|
+
NotificationModel.countDocuments({ isRead: false, userId })
|
|
9833
|
+
]);
|
|
9834
|
+
pubsub.publish("GET_NOTIFICATIONS" /* GET_NOTIFICATIONS */, {
|
|
9835
|
+
getNotifications: userNotifications,
|
|
9836
|
+
getNotificationsUserId: userId
|
|
9837
|
+
});
|
|
9838
|
+
pubsub.publish("GET_NOTIFICATIONS_COUNT" /* GET_NOTIFICATIONS_COUNT */, {
|
|
9839
|
+
getNotificationsCount: { total, unread, userId }
|
|
9840
|
+
});
|
|
9841
|
+
console.log(`Published notification events for user: ${String(userId)}`);
|
|
9842
|
+
} catch (error) {
|
|
9843
|
+
console.error(
|
|
9844
|
+
`Failed to publish notification events for user ${String(userId)}:`,
|
|
9845
|
+
error
|
|
9846
|
+
);
|
|
9847
|
+
}
|
|
9848
|
+
}
|
|
9849
|
+
async function notifyUsers({
|
|
9850
|
+
payload,
|
|
9851
|
+
pubsub
|
|
9852
|
+
}) {
|
|
9853
|
+
try {
|
|
9854
|
+
await sendPushNotifications(payload);
|
|
9855
|
+
const uniqueUserIds = await saveNotificationsInDb(payload);
|
|
9856
|
+
if (!pubsub) {
|
|
9857
|
+
return;
|
|
9858
|
+
}
|
|
9859
|
+
for (const userId of uniqueUserIds) {
|
|
9860
|
+
await publishNotificationEvents(userId, pubsub);
|
|
9861
|
+
}
|
|
9862
|
+
} catch (error) {
|
|
9863
|
+
console.error("Error in notifyUsers:", error);
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9790
9867
|
// src/service/updateAdStatus.ts
|
|
9791
9868
|
async function updateAdStatuses() {
|
|
9792
9869
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -9823,9 +9900,9 @@ async function updateAdStatuses() {
|
|
|
9823
9900
|
}
|
|
9824
9901
|
|
|
9825
9902
|
// src/service/associate.ts
|
|
9826
|
-
var
|
|
9903
|
+
var import_mongoose32 = __toESM(require("mongoose"));
|
|
9827
9904
|
function normalizeObjectId(id) {
|
|
9828
|
-
return typeof id === "string" ? new
|
|
9905
|
+
return typeof id === "string" ? new import_mongoose32.default.Types.ObjectId(id) : id;
|
|
9829
9906
|
}
|
|
9830
9907
|
async function getAssociateEmailsForResource({
|
|
9831
9908
|
normalizedResourceId,
|
|
@@ -9977,12 +10054,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9977
10054
|
}
|
|
9978
10055
|
|
|
9979
10056
|
// src/service/objectIdToString.ts
|
|
9980
|
-
var
|
|
10057
|
+
var import_mongoose35 = __toESM(require("mongoose"));
|
|
9981
10058
|
function convertObjectIdsToStrings(obj) {
|
|
9982
10059
|
if (obj === null || obj === void 0) {
|
|
9983
10060
|
return obj;
|
|
9984
10061
|
}
|
|
9985
|
-
if (obj instanceof
|
|
10062
|
+
if (obj instanceof import_mongoose35.default.Types.ObjectId) {
|
|
9986
10063
|
return obj.toString();
|
|
9987
10064
|
}
|
|
9988
10065
|
if (obj instanceof Date) {
|
|
@@ -10179,6 +10256,8 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
10179
10256
|
mapVendorLicenceToSubscriptionRewardType,
|
|
10180
10257
|
normalizeAffiliatePromoCodes,
|
|
10181
10258
|
normalizePromoCode,
|
|
10259
|
+
notifyUsers,
|
|
10260
|
+
publishNotificationEvents,
|
|
10182
10261
|
saveNotificationsInDb,
|
|
10183
10262
|
sendPushNotifications,
|
|
10184
10263
|
updateAdStatuses,
|