@timardex/cluemart-server-shared 1.0.143 → 1.0.145
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-FA5DXWVE.mjs → chunk-ZKCRLNCH.mjs} +2 -1
- package/dist/index.cjs +36 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +32 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +34 -2
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +34 -1
- package/dist/service/index.mjs.map +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-FA5DXWVE.mjs.map → chunk-ZKCRLNCH.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -12605,6 +12605,37 @@ async function updateAdStatuses() {
|
|
|
12605
12605
|
);
|
|
12606
12606
|
}
|
|
12607
12607
|
|
|
12608
|
+
// src/service/associate.ts
|
|
12609
|
+
async function removeAssociateFromResource(resourceId, resourceType) {
|
|
12610
|
+
const normalizedResourceId = resourceId.toString();
|
|
12611
|
+
try {
|
|
12612
|
+
await UserModel.updateMany(
|
|
12613
|
+
{
|
|
12614
|
+
associates: {
|
|
12615
|
+
$elemMatch: {
|
|
12616
|
+
resourceId: normalizedResourceId,
|
|
12617
|
+
resourceType
|
|
12618
|
+
}
|
|
12619
|
+
}
|
|
12620
|
+
},
|
|
12621
|
+
{
|
|
12622
|
+
$pull: {
|
|
12623
|
+
associates: {
|
|
12624
|
+
resourceId: normalizedResourceId,
|
|
12625
|
+
resourceType
|
|
12626
|
+
}
|
|
12627
|
+
}
|
|
12628
|
+
}
|
|
12629
|
+
).exec();
|
|
12630
|
+
} catch (error) {
|
|
12631
|
+
console.error(
|
|
12632
|
+
`[removeAssociateFromResource] Failed to remove associates for resourceId=${normalizedResourceId}, resourceType=${resourceType}`,
|
|
12633
|
+
error
|
|
12634
|
+
);
|
|
12635
|
+
throw error;
|
|
12636
|
+
}
|
|
12637
|
+
}
|
|
12638
|
+
|
|
12608
12639
|
// src/service/vendor.ts
|
|
12609
12640
|
async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
12610
12641
|
try {
|
|
@@ -12657,6 +12688,7 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
12657
12688
|
},
|
|
12658
12689
|
{ new: true }
|
|
12659
12690
|
);
|
|
12691
|
+
await removeAssociateFromResource(userVendor._id, EnumResourceType.VENDOR);
|
|
12660
12692
|
} catch (error) {
|
|
12661
12693
|
console.error("Error updating vendor based on user license:", error);
|
|
12662
12694
|
}
|