propro-utils 1.5.85 → 1.5.86

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.
@@ -139,11 +139,7 @@ const checkIfUserExists = async accountId => {
139
139
  // Find existing user with populated fields
140
140
  const user = await userSchema
141
141
  .findOne({ accountId })
142
- .populate('userGlobalStyles')
143
- .populate({
144
- path: 'theme',
145
- model: 'Theme',
146
- })
142
+ .select('-theme -folderList -userGlobalStyles -mapList')
147
143
  .lean();
148
144
 
149
145
  if (user) {
@@ -231,13 +227,11 @@ const checkIfUserExists = async accountId => {
231
227
  // Wait for all updates to complete
232
228
  await Promise.all(updates);
233
229
 
234
- // Return fresh user data after updates
235
- return userSchema.findOne({ accountId });
236
- // .populate('userGlobalStyles')
237
- // .populate({
238
- // path: 'theme',
239
- // model: 'Theme',
240
- // });
230
+ // Return fresh user data after updates, excluding specified fields
231
+ return userSchema
232
+ .findOne({ accountId })
233
+ .select('-theme -folderList -userGlobalStyles -mapList')
234
+ .lean();
241
235
  }
242
236
 
243
237
  // Create new user with all associated data
@@ -285,20 +279,17 @@ const checkIfUserExists = async accountId => {
285
279
  userGlobalStyles: userGlobalStyles?._id,
286
280
  theme: defaultTheme ? [defaultTheme._id] : undefined,
287
281
  });
288
- console.log('Created user with theme:', newUser.theme);
289
282
 
290
283
  // Create folders if schema available
291
284
  if (folderSchema) {
292
285
  await createDefaultFolders(folderSchema, newUser.id);
293
286
  }
294
287
 
295
- // Return complete user object with populated fields
296
- return userSchema.findById(newUser._id);
297
- // .populate('userGlobalStyles')
298
- // .populate({
299
- // path: 'theme',
300
- // model: 'Theme',
301
- // });
288
+ // Return user object excluding specified fields
289
+ return userSchema
290
+ .findById(newUser._id)
291
+ .select('-theme -folderList -userGlobalStyles -mapList')
292
+ .lean();
302
293
  } catch (error) {
303
294
  console.error('Error in checkIfUserExists:', {
304
295
  accountId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.5.85",
3
+ "version": "1.5.86",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {