propro-utils 1.5.77 → 1.5.79

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.
@@ -140,7 +140,10 @@ const checkIfUserExists = async accountId => {
140
140
  const user = await userSchema
141
141
  .findOne({ accountId })
142
142
  .populate('userGlobalStyles')
143
- .populate('theme')
143
+ .populate({
144
+ path: 'theme',
145
+ model: 'Theme',
146
+ })
144
147
  .lean();
145
148
 
146
149
  if (user) {
@@ -213,6 +216,7 @@ const checkIfUserExists = async accountId => {
213
216
  accountId,
214
217
  userId: user.id,
215
218
  id: uuidv4(),
219
+ isDefault: true,
216
220
  });
217
221
 
218
222
  await userSchema.updateOne(
@@ -231,7 +235,10 @@ const checkIfUserExists = async accountId => {
231
235
  return userSchema
232
236
  .findOne({ accountId })
233
237
  .populate('userGlobalStyles')
234
- .populate('theme');
238
+ .populate({
239
+ path: 'theme',
240
+ model: 'Theme',
241
+ });
235
242
  }
236
243
 
237
244
  // Create new user with all associated data
@@ -261,6 +268,7 @@ const checkIfUserExists = async accountId => {
261
268
  id: uuidv4(),
262
269
  })
263
270
  .then(theme => {
271
+ console.log('Created theme:', theme);
264
272
  defaultTheme = theme;
265
273
  return theme;
266
274
  })
@@ -278,6 +286,7 @@ const checkIfUserExists = async accountId => {
278
286
  userGlobalStyles: userGlobalStyles?._id,
279
287
  theme: defaultTheme ? [defaultTheme._id] : undefined,
280
288
  });
289
+ console.log('Created user with theme:', newUser.theme);
281
290
 
282
291
  // Create folders if schema available
283
292
  if (folderSchema) {
@@ -288,7 +297,10 @@ const checkIfUserExists = async accountId => {
288
297
  return userSchema
289
298
  .findById(newUser._id)
290
299
  .populate('userGlobalStyles')
291
- .populate('theme');
300
+ .populate({
301
+ path: 'theme',
302
+ model: 'Theme',
303
+ });
292
304
  } catch (error) {
293
305
  console.error('Error in checkIfUserExists:', {
294
306
  accountId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.5.77",
3
+ "version": "1.5.79",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {