shuttlepro-shared 1.4.88 → 1.4.90

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.
Files changed (2) hide show
  1. package/models/Profile.js +18 -16
  2. package/package.json +1 -1
package/models/Profile.js CHANGED
@@ -49,14 +49,17 @@ const fetchProfiles = async (workspaceId) => {
49
49
 
50
50
  const fetchByProfileIdAndWorkspaceId = async (id, workspaceId) => {
51
51
  try {
52
- let profiles = await fetchProfiles(workspaceId);
53
- let profile = profiles.find(
54
- (p) =>
55
- (p?.profileId === id || p._id.toString() === id.toString()) &&
56
- p?.workspaceId.toString() === workspaceId.toString()
57
- );
52
+ // Direct database fetch without Redis (to avoid Redis issues in webhook routes)
53
+ const profile = await Profile.findOne({
54
+ $or: [
55
+ { profileId: id },
56
+ { _id: id }
57
+ ],
58
+ workspaceId: workspaceId
59
+ }).lean().exec();
58
60
  return profile || null;
59
61
  } catch (err) {
62
+ console.log(err, "err in fetchByProfileIdAndWorkspaceId");
60
63
  return null;
61
64
  }
62
65
  };
@@ -66,15 +69,14 @@ const fetchProfileByEmailAndWorkspaceId = async (
66
69
  userName = ""
67
70
  ) => {
68
71
  try {
69
- let profiles = await fetchProfiles(workspaceId);
70
- let profile = profiles.find(
71
- (p) =>
72
- p?.userName === userName &&
73
- p?.workspaceId?.toString() === workspaceId?.toString()
74
- );
72
+ // Direct database fetch without Redis (to avoid Redis issues)
73
+ const profile = await Profile.findOne({
74
+ userName: userName,
75
+ workspaceId: workspaceId
76
+ }).lean().exec();
75
77
  return profile || null;
76
78
  } catch (err) {
77
- console.log(err, "err");
79
+ console.log(err, "err in fetchProfileByEmailAndWorkspaceId");
78
80
  return null;
79
81
  }
80
82
  };
@@ -82,7 +84,7 @@ const fetchProfileByEmailAndWorkspaceId = async (
82
84
  const createProfile = async (obj) => {
83
85
  try {
84
86
  let profile = await Profile.create(obj);
85
- await addOrUpdateProfilesInRedis(profile);
87
+ // await addOrUpdateProfilesInRedis(profile);
86
88
  return profile;
87
89
  } catch (err) {
88
90
  console.log(err, "err");
@@ -99,7 +101,7 @@ const createUpdateProfileModified = async (filter, obj) => {
99
101
  upsert: true,
100
102
  }
101
103
  );
102
- await addOrUpdateProfilesInRedis(profile);
104
+ // await addOrUpdateProfilesInRedis(profile);
103
105
  return profile;
104
106
  } catch (err) {
105
107
  console.log(err, "err");
@@ -111,7 +113,7 @@ const updateProfile = async (query, payload) => {
111
113
  const profile = await Profile.findOneAndUpdate(query, payload, {
112
114
  new: true,
113
115
  });
114
- await addOrUpdateProfilesInRedis(profile);
116
+ // await addOrUpdateProfilesInRedis(profile);
115
117
  return profile;
116
118
  } catch (err) {
117
119
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.88",
3
+ "version": "1.4.90",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {