@timardex/cluemart-server-shared 1.0.299 → 1.0.300
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-CiXqVASx.d.mts → Affiliate-BxNv9k41.d.mts} +2 -23
- package/dist/{Affiliate-B3kOq3DU.d.ts → Affiliate-DRuifOv4.d.ts} +2 -23
- package/dist/{chunk-UEGYYYX5.mjs → chunk-6WS5FH7A.mjs} +2 -68
- package/dist/chunk-6WS5FH7A.mjs.map +1 -0
- package/dist/index.cjs +3 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -23
- package/dist/index.d.ts +2 -23
- package/dist/index.mjs +3 -182
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +1 -67
- 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 -3
- package/dist/service/index.cjs +3 -181
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +1 -1
- package/dist/service/index.d.ts +1 -1
- package/dist/service/index.mjs +3 -119
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-UEGYYYX5.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-Wn7yfc3v.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-Wn7yfc3v.mjs';
|
|
6
|
-
import { S as SchemaOwnerType } from '../Affiliate-
|
|
7
|
-
export { A as AffiliateModel, C as CategorySchema,
|
|
6
|
+
import { S as SchemaOwnerType } from '../Affiliate-BxNv9k41.mjs';
|
|
7
|
+
export { A as AffiliateModel, C as CategorySchema, c as ContactDetailsSchema, O as OwnerTypeSchema, k as RelationModel, j as RelationTypeSchema, R as ResourceImageTypeSchema, n as SchemaAffiliateResourceType, m as SchemaAffiliateReward, a as SchemaRelatedPostType, i as SchemaRelationType, b as SocialMediaTypeSchema, g as baseResourceFields, d as dateTimeSchema, l as locationGeoSchema, e as locationsSchema, f as relatedPostSchema, h as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-BxNv9k41.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-Wn7yfc3v.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-Wn7yfc3v.js';
|
|
6
|
-
import { S as SchemaOwnerType } from '../Affiliate-
|
|
7
|
-
export { A as AffiliateModel, C as CategorySchema,
|
|
6
|
+
import { S as SchemaOwnerType } from '../Affiliate-DRuifOv4.js';
|
|
7
|
+
export { A as AffiliateModel, C as CategorySchema, c as ContactDetailsSchema, O as OwnerTypeSchema, k as RelationModel, j as RelationTypeSchema, R as ResourceImageTypeSchema, n as SchemaAffiliateResourceType, m as SchemaAffiliateReward, a as SchemaRelatedPostType, i as SchemaRelationType, b as SocialMediaTypeSchema, g as baseResourceFields, d as dateTimeSchema, l as locationGeoSchema, e as locationsSchema, f as relatedPostSchema, h as relationDatesSchema, r as resourceRelationsSchema, s as socialShareResourceSchema, t as termsAgreementSchema, u as userLicenseSchema } from '../Affiliate-DRuifOv4.js';
|
|
8
8
|
import '@timardex/cluemart-shared/types';
|
|
9
9
|
import 'express';
|
|
10
10
|
|
package/dist/mongoose/index.mjs
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
VendorInfoModel,
|
|
29
29
|
VendorModel,
|
|
30
30
|
VerificationTokenModel,
|
|
31
|
-
associatesSchema,
|
|
32
31
|
baseResourceFields,
|
|
33
32
|
dateTimeSchema,
|
|
34
33
|
locationGeoSchema,
|
|
@@ -40,7 +39,7 @@ import {
|
|
|
40
39
|
socialShareResourceSchema,
|
|
41
40
|
termsAgreementSchema,
|
|
42
41
|
userLicenseSchema
|
|
43
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-6WS5FH7A.mjs";
|
|
44
43
|
export {
|
|
45
44
|
APP_SETTINGS_ID,
|
|
46
45
|
AdModel,
|
|
@@ -71,7 +70,6 @@ export {
|
|
|
71
70
|
VendorInfoModel,
|
|
72
71
|
VendorModel,
|
|
73
72
|
VerificationTokenModel,
|
|
74
|
-
associatesSchema,
|
|
75
73
|
baseResourceFields,
|
|
76
74
|
dateTimeSchema,
|
|
77
75
|
locationGeoSchema,
|
package/dist/service/index.cjs
CHANGED
|
@@ -3336,9 +3336,6 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource22) => {
|
|
|
3336
3336
|
return EnumRelationResource22;
|
|
3337
3337
|
})(EnumRelationResource || {});
|
|
3338
3338
|
var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType22) => {
|
|
3339
|
-
EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_EVENT"] = "added_as_associate_event";
|
|
3340
|
-
EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_PARTNER"] = "added_as_associate_partner";
|
|
3341
|
-
EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_VENDOR"] = "added_as_associate_vendor";
|
|
3342
3339
|
EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
|
|
3343
3340
|
EnumNotificationResourceType22["AFFILIATE_REWARD_RECEIVED"] = "affiliate_reward_received";
|
|
3344
3341
|
EnumNotificationResourceType22["APPROVED_EVENT"] = "approved_event";
|
|
@@ -5002,17 +4999,6 @@ var LICENCE_FIELDS_FRAGMENT = gql`
|
|
|
5002
4999
|
prevLicenceType
|
|
5003
5000
|
}
|
|
5004
5001
|
`;
|
|
5005
|
-
var ASSOCIATES_FIELDS_FRAGMENT = gql`
|
|
5006
|
-
fragment AssociatesFields on AssociateType {
|
|
5007
|
-
email
|
|
5008
|
-
resourceId
|
|
5009
|
-
resourceType
|
|
5010
|
-
licence {
|
|
5011
|
-
...LicenceFields
|
|
5012
|
-
}
|
|
5013
|
-
}
|
|
5014
|
-
${LICENCE_FIELDS_FRAGMENT}
|
|
5015
|
-
`;
|
|
5016
5002
|
var TERMS_AGREEMENT_FIELDS_FRAGMENT = gql`
|
|
5017
5003
|
fragment TermsAgreementFields on TermsAgreementType {
|
|
5018
5004
|
appBuildNumber
|
|
@@ -5103,9 +5089,6 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
5103
5089
|
fragment UserFields on UserType {
|
|
5104
5090
|
_id
|
|
5105
5091
|
active
|
|
5106
|
-
associates {
|
|
5107
|
-
...AssociatesFields
|
|
5108
|
-
}
|
|
5109
5092
|
affiliate
|
|
5110
5093
|
avatar {
|
|
5111
5094
|
...ResourceImageFields
|
|
@@ -5145,7 +5128,6 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
5145
5128
|
updatedAt
|
|
5146
5129
|
}
|
|
5147
5130
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5148
|
-
${ASSOCIATES_FIELDS_FRAGMENT}
|
|
5149
5131
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
5150
5132
|
${USER_ACTIVITY_FIELDS_FRAGMENT}
|
|
5151
5133
|
${LICENCE_FIELDS_FRAGMENT}
|
|
@@ -5291,9 +5273,6 @@ var EVENT = gql`
|
|
|
5291
5273
|
fragment EventFields on EventType {
|
|
5292
5274
|
_id
|
|
5293
5275
|
active
|
|
5294
|
-
associates {
|
|
5295
|
-
...AssociatesFields
|
|
5296
|
-
}
|
|
5297
5276
|
adIds
|
|
5298
5277
|
approvedAt
|
|
5299
5278
|
cover {
|
|
@@ -5366,7 +5345,6 @@ var EVENT = gql`
|
|
|
5366
5345
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5367
5346
|
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
5368
5347
|
${POSTER_USAGE_FIELDS_FRAGMENT}
|
|
5369
|
-
${ASSOCIATES_FIELDS_FRAGMENT}
|
|
5370
5348
|
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
5371
5349
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
5372
5350
|
${RELATION_DATES_FRAGMENT}
|
|
@@ -5479,9 +5457,6 @@ var VENDOR = gql`
|
|
|
5479
5457
|
fragment VendorFields on VendorType {
|
|
5480
5458
|
_id
|
|
5481
5459
|
active
|
|
5482
|
-
associates {
|
|
5483
|
-
...AssociatesFields
|
|
5484
|
-
}
|
|
5485
5460
|
adIds
|
|
5486
5461
|
approvedAt
|
|
5487
5462
|
availability {
|
|
@@ -5572,7 +5547,6 @@ var VENDOR = gql`
|
|
|
5572
5547
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5573
5548
|
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
5574
5549
|
${POSTER_USAGE_FIELDS_FRAGMENT}
|
|
5575
|
-
${ASSOCIATES_FIELDS_FRAGMENT}
|
|
5576
5550
|
${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
|
|
5577
5551
|
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
5578
5552
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
@@ -5725,9 +5699,6 @@ var PARTNER = gql`
|
|
|
5725
5699
|
fragment PartnerFields on PartnerType {
|
|
5726
5700
|
_id
|
|
5727
5701
|
active
|
|
5728
|
-
associates {
|
|
5729
|
-
...AssociatesFields
|
|
5730
|
-
}
|
|
5731
5702
|
adIds
|
|
5732
5703
|
approvedAt
|
|
5733
5704
|
cover {
|
|
@@ -5778,7 +5749,6 @@ var PARTNER = gql`
|
|
|
5778
5749
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
5779
5750
|
${LOCATION_FIELDS_FRAGMENT}
|
|
5780
5751
|
${OWNER_FIELDS_FRAGMENT}
|
|
5781
|
-
${ASSOCIATES_FIELDS_FRAGMENT}
|
|
5782
5752
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5783
5753
|
${POSTER_USAGE_FIELDS_FRAGMENT}
|
|
5784
5754
|
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
@@ -6225,7 +6195,6 @@ var CHAT_MESSAGE_FIELDS_FRAGMENT = gql`
|
|
|
6225
6195
|
var CHAT_PARTICIPANT = gql`
|
|
6226
6196
|
fragment ChatParticipantFields on ChatParticipantType {
|
|
6227
6197
|
active
|
|
6228
|
-
isAssociate
|
|
6229
6198
|
userAvatar
|
|
6230
6199
|
userEmail
|
|
6231
6200
|
userId
|
|
@@ -7703,7 +7672,6 @@ var MessageSchema = new MongooseSchema2(
|
|
|
7703
7672
|
var ParticipantSchema = new MongooseSchema2(
|
|
7704
7673
|
{
|
|
7705
7674
|
active: { default: true, required: true, type: Boolean },
|
|
7706
|
-
isAssociate: { default: null, required: false, type: Boolean },
|
|
7707
7675
|
userAvatar: { required: false, type: String },
|
|
7708
7676
|
userEmail: { required: true, type: String },
|
|
7709
7677
|
userId: {
|
|
@@ -8028,26 +7996,6 @@ var userLicenseSchema = new MongooseSchema6(
|
|
|
8028
7996
|
},
|
|
8029
7997
|
{ _id: false, timestamps: false }
|
|
8030
7998
|
);
|
|
8031
|
-
var associatesSchema = new MongooseSchema6(
|
|
8032
|
-
{
|
|
8033
|
-
email: { required: true, type: String },
|
|
8034
|
-
licence: {
|
|
8035
|
-
required: true,
|
|
8036
|
-
type: userLicenseSchema
|
|
8037
|
-
},
|
|
8038
|
-
resourceId: {
|
|
8039
|
-
required: true,
|
|
8040
|
-
type: String
|
|
8041
|
-
},
|
|
8042
|
-
resourceType: {
|
|
8043
|
-
enum: Object.values(EnumResourceType),
|
|
8044
|
-
required: true,
|
|
8045
|
-
type: String
|
|
8046
|
-
}
|
|
8047
|
-
},
|
|
8048
|
-
{ _id: false }
|
|
8049
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8050
|
-
);
|
|
8051
7999
|
var ContactDetailsSchema = new MongooseSchema6(
|
|
8052
8000
|
{
|
|
8053
8001
|
email: { required: false, type: String },
|
|
@@ -8163,10 +8111,6 @@ var baseResourceFields = {
|
|
|
8163
8111
|
type: [import_mongoose6.default.Schema.Types.ObjectId]
|
|
8164
8112
|
},
|
|
8165
8113
|
approvedAt: { default: null, required: false, type: Date },
|
|
8166
|
-
associates: {
|
|
8167
|
-
required: false,
|
|
8168
|
-
type: [associatesSchema]
|
|
8169
|
-
},
|
|
8170
8114
|
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
8171
8115
|
cover: {
|
|
8172
8116
|
required: true,
|
|
@@ -8310,7 +8254,7 @@ schema4.index({ isRead: 1, userId: 1 });
|
|
|
8310
8254
|
schema4.index({ createdAt: -1, userId: 1 });
|
|
8311
8255
|
var NotificationModel = import_mongoose8.default.models.Notification || import_mongoose8.default.model("Notification", schema4);
|
|
8312
8256
|
|
|
8313
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
8257
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-X3OLM35T.mjs
|
|
8314
8258
|
var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
|
|
8315
8259
|
EnumOSPlatform22["ANDROID"] = "android";
|
|
8316
8260
|
EnumOSPlatform22["IOS"] = "ios";
|
|
@@ -8471,10 +8415,6 @@ var schema7 = new MongooseSchema11(
|
|
|
8471
8415
|
required: false,
|
|
8472
8416
|
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8473
8417
|
},
|
|
8474
|
-
associates: {
|
|
8475
|
-
required: false,
|
|
8476
|
-
type: [associatesSchema]
|
|
8477
|
-
},
|
|
8478
8418
|
avatar: {
|
|
8479
8419
|
required: false,
|
|
8480
8420
|
type: ResourceImageTypeSchema
|
|
@@ -8574,7 +8514,6 @@ var schema7 = new MongooseSchema11(
|
|
|
8574
8514
|
},
|
|
8575
8515
|
{ strict: false, timestamps: true }
|
|
8576
8516
|
);
|
|
8577
|
-
schema7.index({ "associates.email": 1 });
|
|
8578
8517
|
schema7.index({ "licences.expiryDate": 1 });
|
|
8579
8518
|
schema7.index({ "licences.licenceType": 1 });
|
|
8580
8519
|
var UserModel = import_mongoose11.default.models.User || import_mongoose11.default.model("User", schema7);
|
|
@@ -8692,7 +8631,6 @@ schema9.index({ name: 1 });
|
|
|
8692
8631
|
schema9.index({ description: 1 });
|
|
8693
8632
|
schema9.index({ region: 1 });
|
|
8694
8633
|
schema9.index({ "categories.name": 1 });
|
|
8695
|
-
schema9.index({ "associates.email": 1 });
|
|
8696
8634
|
schema9.index({ slug: 1 });
|
|
8697
8635
|
var VendorModel = import_mongoose13.default.models.Vendor || import_mongoose13.default.model("Vendor", schema9);
|
|
8698
8636
|
|
|
@@ -8831,7 +8769,6 @@ schema12.index({ description: 1 });
|
|
|
8831
8769
|
schema12.index({ region: 1 });
|
|
8832
8770
|
schema12.index({ "location.geo": "2dsphere" });
|
|
8833
8771
|
schema12.index({ tags: 1 });
|
|
8834
|
-
schema12.index({ "associates.email": 1 });
|
|
8835
8772
|
schema12.index({ deletedAt: 1 });
|
|
8836
8773
|
schema12.index({ "dateTime.dateStatus": 1 });
|
|
8837
8774
|
schema12.index({ slug: 1 });
|
|
@@ -8860,7 +8797,6 @@ schema13.index({ name: 1 });
|
|
|
8860
8797
|
schema13.index({ description: 1 });
|
|
8861
8798
|
schema13.index({ region: 1 });
|
|
8862
8799
|
schema13.index({ "location.geo": "2dsphere" });
|
|
8863
|
-
schema13.index({ "associates.email": 1 });
|
|
8864
8800
|
schema13.index({ slug: 1 });
|
|
8865
8801
|
var PartnerModel = import_mongoose17.default.models.Partner || import_mongoose17.default.model("Partner", schema13);
|
|
8866
8802
|
|
|
@@ -9802,112 +9738,6 @@ async function updateAdStatuses() {
|
|
|
9802
9738
|
);
|
|
9803
9739
|
}
|
|
9804
9740
|
|
|
9805
|
-
// src/service/associate.ts
|
|
9806
|
-
var import_mongoose32 = __toESM(require("mongoose"));
|
|
9807
|
-
function normalizeObjectId(id) {
|
|
9808
|
-
return typeof id === "string" ? new import_mongoose32.default.Types.ObjectId(id) : id;
|
|
9809
|
-
}
|
|
9810
|
-
async function getAssociateEmailsForResource({
|
|
9811
|
-
normalizedResourceId,
|
|
9812
|
-
resourceType
|
|
9813
|
-
}) {
|
|
9814
|
-
const usersWithAssociates = await UserModel.find(
|
|
9815
|
-
{
|
|
9816
|
-
associates: {
|
|
9817
|
-
$elemMatch: {
|
|
9818
|
-
resourceId: normalizedResourceId,
|
|
9819
|
-
resourceType
|
|
9820
|
-
}
|
|
9821
|
-
}
|
|
9822
|
-
},
|
|
9823
|
-
{
|
|
9824
|
-
associates: 1
|
|
9825
|
-
}
|
|
9826
|
-
).lean();
|
|
9827
|
-
return [
|
|
9828
|
-
...new Set(
|
|
9829
|
-
usersWithAssociates.flatMap(
|
|
9830
|
-
(user) => (user.associates ?? []).filter(
|
|
9831
|
-
(associate) => associate.resourceId === normalizedResourceId && associate.resourceType === resourceType
|
|
9832
|
-
).map((associate) => associate.email)
|
|
9833
|
-
)
|
|
9834
|
-
)
|
|
9835
|
-
];
|
|
9836
|
-
}
|
|
9837
|
-
async function pullAssociatesFromUsers({
|
|
9838
|
-
normalizedResourceId,
|
|
9839
|
-
resourceType
|
|
9840
|
-
}) {
|
|
9841
|
-
await UserModel.updateMany(
|
|
9842
|
-
{
|
|
9843
|
-
associates: {
|
|
9844
|
-
$elemMatch: {
|
|
9845
|
-
resourceId: normalizedResourceId,
|
|
9846
|
-
resourceType
|
|
9847
|
-
}
|
|
9848
|
-
}
|
|
9849
|
-
},
|
|
9850
|
-
{
|
|
9851
|
-
$pull: {
|
|
9852
|
-
associates: {
|
|
9853
|
-
resourceId: normalizedResourceId,
|
|
9854
|
-
resourceType
|
|
9855
|
-
}
|
|
9856
|
-
}
|
|
9857
|
-
}
|
|
9858
|
-
);
|
|
9859
|
-
}
|
|
9860
|
-
async function pullAssociateParticipantsFromChats(resourceOwnerId, associateEmails) {
|
|
9861
|
-
await ChatModel.updateMany(
|
|
9862
|
-
{
|
|
9863
|
-
active: true,
|
|
9864
|
-
chatType: EnumChatType.RELATION,
|
|
9865
|
-
deletedAt: null,
|
|
9866
|
-
participants: {
|
|
9867
|
-
$elemMatch: {
|
|
9868
|
-
userId: resourceOwnerId
|
|
9869
|
-
}
|
|
9870
|
-
}
|
|
9871
|
-
},
|
|
9872
|
-
{
|
|
9873
|
-
$pull: {
|
|
9874
|
-
participants: {
|
|
9875
|
-
isAssociate: true,
|
|
9876
|
-
userEmail: {
|
|
9877
|
-
$in: associateEmails
|
|
9878
|
-
}
|
|
9879
|
-
}
|
|
9880
|
-
}
|
|
9881
|
-
}
|
|
9882
|
-
);
|
|
9883
|
-
}
|
|
9884
|
-
async function removeAssociateFromResource({
|
|
9885
|
-
resourceId,
|
|
9886
|
-
resourceOwnerId,
|
|
9887
|
-
resourceType
|
|
9888
|
-
}) {
|
|
9889
|
-
try {
|
|
9890
|
-
const scope = {
|
|
9891
|
-
normalizedResourceId: resourceId.toString(),
|
|
9892
|
-
resourceType
|
|
9893
|
-
};
|
|
9894
|
-
const associateEmails = await getAssociateEmailsForResource(scope);
|
|
9895
|
-
if (associateEmails.length === 0) {
|
|
9896
|
-
return;
|
|
9897
|
-
}
|
|
9898
|
-
await pullAssociatesFromUsers(scope);
|
|
9899
|
-
await pullAssociateParticipantsFromChats(
|
|
9900
|
-
normalizeObjectId(resourceOwnerId),
|
|
9901
|
-
associateEmails
|
|
9902
|
-
);
|
|
9903
|
-
} catch (error) {
|
|
9904
|
-
console.error(
|
|
9905
|
-
`[removeAssociateFromResource] Failed for resourceId=${resourceId}, resourceType=${resourceType}`,
|
|
9906
|
-
error
|
|
9907
|
-
);
|
|
9908
|
-
}
|
|
9909
|
-
}
|
|
9910
|
-
|
|
9911
9741
|
// src/service/vendor.ts
|
|
9912
9742
|
async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
9913
9743
|
try {
|
|
@@ -9924,7 +9754,6 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9924
9754
|
const updateData = {};
|
|
9925
9755
|
const isStandardVendor = licenceType === EnumUserLicence.STANDARD_VENDOR;
|
|
9926
9756
|
if (isStandardVendor) {
|
|
9927
|
-
updateData.associates = [];
|
|
9928
9757
|
updateData.availability = {
|
|
9929
9758
|
corporate: false,
|
|
9930
9759
|
private: false,
|
|
@@ -9944,25 +9773,18 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9944
9773
|
active: isStandardVendor ? index < 6 : true
|
|
9945
9774
|
}));
|
|
9946
9775
|
await VendorModel.updateOne({ _id: vendor._id }, { $set: updateData });
|
|
9947
|
-
if (isStandardVendor) {
|
|
9948
|
-
await removeAssociateFromResource({
|
|
9949
|
-
resourceId: vendor._id,
|
|
9950
|
-
resourceOwnerId: vendor.owner.userId,
|
|
9951
|
-
resourceType: EnumResourceType.VENDOR
|
|
9952
|
-
});
|
|
9953
|
-
}
|
|
9954
9776
|
} catch (error) {
|
|
9955
9777
|
console.error("[updateVendorBasedOnUserLicense] Failed:", error);
|
|
9956
9778
|
}
|
|
9957
9779
|
}
|
|
9958
9780
|
|
|
9959
9781
|
// src/service/objectIdToString.ts
|
|
9960
|
-
var
|
|
9782
|
+
var import_mongoose33 = __toESM(require("mongoose"));
|
|
9961
9783
|
function convertObjectIdsToStrings(obj) {
|
|
9962
9784
|
if (obj === null || obj === void 0) {
|
|
9963
9785
|
return obj;
|
|
9964
9786
|
}
|
|
9965
|
-
if (obj instanceof
|
|
9787
|
+
if (obj instanceof import_mongoose33.default.Types.ObjectId) {
|
|
9966
9788
|
return obj.toString();
|
|
9967
9789
|
}
|
|
9968
9790
|
if (obj instanceof Date) {
|