shuttlepro-shared 1.3.69 → 1.3.71
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/models/Automation.js
CHANGED
|
@@ -55,6 +55,12 @@ const AutomationAction = new Schema({
|
|
|
55
55
|
templateId: descriptionJoin,
|
|
56
56
|
delay: defaultStringType,
|
|
57
57
|
},
|
|
58
|
+
markAsSpam: {
|
|
59
|
+
enabled: { type: Boolean, default: false },
|
|
60
|
+
},
|
|
61
|
+
deleteComment: {
|
|
62
|
+
enabled: { type: Boolean, default: false },
|
|
63
|
+
},
|
|
58
64
|
sendCollection: {
|
|
59
65
|
enabled: { type: Boolean, default: false },
|
|
60
66
|
template: { type: Object, default: null },
|
package/models/Chatbot.js
CHANGED
package/models/Product.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
const mongoose = require("mongoose");
|
|
2
2
|
const { Schema } = mongoose;
|
|
3
3
|
const axios = require("axios");
|
|
4
|
-
const {
|
|
5
|
-
updateEmbedding,
|
|
6
|
-
deleteEmbedding,
|
|
7
|
-
} = require("../utils/services/embedding-api.service");
|
|
8
4
|
const NewProduct = require("./NewProduct"); // Make sure to import NewProduct model
|
|
9
5
|
|
|
10
6
|
const categorySchema = new Schema({
|
|
@@ -49,6 +45,8 @@ const ProductSchema = new Schema(
|
|
|
49
45
|
updating: { type: Boolean, default: false },
|
|
50
46
|
attributes: [],
|
|
51
47
|
bcProductId: { type: String, default: "" },
|
|
48
|
+
presentedCurrency: { type: String, default: "" },
|
|
49
|
+
presentedCurrencySymbol: { type: String, default: "" },
|
|
52
50
|
},
|
|
53
51
|
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
54
52
|
);
|
|
@@ -169,7 +167,6 @@ const updateNewProduct = async (doc, next) => {
|
|
|
169
167
|
newProductData,
|
|
170
168
|
{ upsert: true, new: true }
|
|
171
169
|
);
|
|
172
|
-
await updateEmbedding(newProductData.id, newProductData.workspaceId);
|
|
173
170
|
}
|
|
174
171
|
} catch (error) {
|
|
175
172
|
console.error("Error updating NewProduct:", error);
|
|
@@ -182,7 +179,6 @@ const deleteNewProduct = async (doc, next) => {
|
|
|
182
179
|
try {
|
|
183
180
|
if (doc) {
|
|
184
181
|
await NewProduct.deleteOne({ id: doc._id });
|
|
185
|
-
await deleteEmbedding(doc._id);
|
|
186
182
|
}
|
|
187
183
|
} catch (error) {
|
|
188
184
|
console.error("Error deleting from NewProduct:", error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shuttlepro-shared",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.71",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"@babel/plugin-proposal-decorators": "^7.22.5",
|
|
17
17
|
"@babel/preset-env": "^7.22.5",
|
|
18
18
|
"@babel/register": "^7.22.5",
|
|
19
|
-
"axios": "^0.21.1",
|
|
20
19
|
"bull": "^4.10.4",
|
|
21
20
|
"cors": "^2.8.5",
|
|
22
21
|
"express": "^4.17.1",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const axios = require("axios");
|
|
2
|
-
|
|
3
|
-
const axiosInstance = axios.create({
|
|
4
|
-
timeout: 5000, // 5 seconds
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
const EMBEDDING_SERVICE_URL = process.env.EMBEDDING_SERVER_URL;
|
|
8
|
-
|
|
9
|
-
const updateEmbedding = async (productId, workspaceId) => {
|
|
10
|
-
if (!EMBEDDING_SERVICE_URL) {
|
|
11
|
-
console.warn("⚠️ EMBEDDING_SERVICE_URL not set. Skipping update call.");
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
await axiosInstance.post(
|
|
17
|
-
`${EMBEDDING_SERVICE_URL}/embedding/${workspaceId}/${productId}`
|
|
18
|
-
);
|
|
19
|
-
console.log(`✅ Updated embedding for productId: ${productId}`);
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error(
|
|
22
|
-
`❌ Failed to update embedding for productId: ${productId}`,
|
|
23
|
-
error
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const deleteEmbedding = async (productId) => {
|
|
29
|
-
if (!EMBEDDING_SERVICE_URL) {
|
|
30
|
-
console.warn("⚠️ EMBEDDING_SERVICE_URL not set. Skipping delete call.");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
await axiosInstance.delete(
|
|
36
|
-
`${EMBEDDING_SERVICE_URL}/embedding/${productId}`
|
|
37
|
-
);
|
|
38
|
-
console.log(`✅ Deleted embedding for productId: ${productId}`);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error(
|
|
41
|
-
`❌ Failed to delete embedding for productId: ${productId}`,
|
|
42
|
-
error
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
module.exports = {
|
|
48
|
-
updateEmbedding,
|
|
49
|
-
deleteEmbedding,
|
|
50
|
-
};
|