shuttlepro-shared 1.2.12 → 1.2.14
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.
|
@@ -68,7 +68,11 @@ const findIntegrationsByWorkspace = async (workspaceId, filter = {}) => {
|
|
|
68
68
|
/**
|
|
69
69
|
* Find integration by filter (supports both workspace & non-workspace).
|
|
70
70
|
*/
|
|
71
|
-
const findIntegrationByFilter = async (
|
|
71
|
+
const findIntegrationByFilter = async (
|
|
72
|
+
filter,
|
|
73
|
+
bodyFilter = {},
|
|
74
|
+
workspaceId = null
|
|
75
|
+
) => {
|
|
72
76
|
const allIntegrations = await getCachedAllIntegrations();
|
|
73
77
|
|
|
74
78
|
let filteredIntegrations = allIntegrations;
|
|
@@ -79,8 +83,12 @@ const findIntegrationByFilter = async (filter, workspaceId = null) => {
|
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
return (
|
|
82
|
-
filteredIntegrations.find(
|
|
83
|
-
|
|
86
|
+
filteredIntegrations.find(
|
|
87
|
+
(item) =>
|
|
88
|
+
Object.entries(filter).every(([key, value]) => item[key] === value) &&
|
|
89
|
+
Object.entries(bodyFilter).every(
|
|
90
|
+
([key, value]) => item.body?.[key] === value
|
|
91
|
+
)
|
|
84
92
|
) || null
|
|
85
93
|
);
|
|
86
94
|
};
|
package/models/Order.js
CHANGED
|
@@ -110,6 +110,7 @@ const OrderSchema = new Schema(
|
|
|
110
110
|
platformFinancialStatus: { type: String, default: "pending" },
|
|
111
111
|
payment: {},
|
|
112
112
|
credentials: {},
|
|
113
|
+
sender: { type: String, default: "" },
|
|
113
114
|
},
|
|
114
115
|
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
115
116
|
);
|
package/models/Profile.js
CHANGED
|
@@ -37,10 +37,12 @@ const addOrUpdateProfilesInRedis = async (profile) => {
|
|
|
37
37
|
const fetchProfiles = async (workspaceId) => {
|
|
38
38
|
try {
|
|
39
39
|
let profiles = await getRedisData(`${workspaceId}-profiles`);
|
|
40
|
+
console.log(profiles, "profiles");
|
|
40
41
|
if (!profiles || profiles.length === 0) {
|
|
41
42
|
profiles = await Profile.find({ workspaceId }).lean().exec();
|
|
42
43
|
setRedisData(`${workspaceId}-profiles`, profiles);
|
|
43
44
|
}
|
|
45
|
+
console.log(profiles, "profiles");
|
|
44
46
|
return profiles;
|
|
45
47
|
} catch (err) {
|
|
46
48
|
return [];
|
|
@@ -49,12 +51,14 @@ const fetchProfiles = async (workspaceId) => {
|
|
|
49
51
|
|
|
50
52
|
const fetchByProfileIdAndWorkspaceId = async (id, workspaceId) => {
|
|
51
53
|
try {
|
|
54
|
+
console.log(id, workspaceId, "id, workspaceId");
|
|
52
55
|
let profiles = await fetchProfiles(workspaceId);
|
|
53
56
|
let profile = profiles.find(
|
|
54
57
|
(p) =>
|
|
55
58
|
(p?.profileId === id || p._id.toString() === id.toString()) &&
|
|
56
59
|
p?.workspaceId.toString() === workspaceId.toString()
|
|
57
60
|
);
|
|
61
|
+
console.log(profile, "profile");
|
|
58
62
|
return profile || null;
|
|
59
63
|
} catch (err) {
|
|
60
64
|
return null;
|