propro-utils 1.5.78 → 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.
- package/middlewares/account_info.js +14 -3
- package/package.json +1 -1
|
@@ -140,7 +140,10 @@ const checkIfUserExists = async accountId => {
|
|
|
140
140
|
const user = await userSchema
|
|
141
141
|
.findOne({ accountId })
|
|
142
142
|
.populate('userGlobalStyles')
|
|
143
|
-
.populate(
|
|
143
|
+
.populate({
|
|
144
|
+
path: 'theme',
|
|
145
|
+
model: 'Theme',
|
|
146
|
+
})
|
|
144
147
|
.lean();
|
|
145
148
|
|
|
146
149
|
if (user) {
|
|
@@ -232,7 +235,10 @@ const checkIfUserExists = async accountId => {
|
|
|
232
235
|
return userSchema
|
|
233
236
|
.findOne({ accountId })
|
|
234
237
|
.populate('userGlobalStyles')
|
|
235
|
-
.populate(
|
|
238
|
+
.populate({
|
|
239
|
+
path: 'theme',
|
|
240
|
+
model: 'Theme',
|
|
241
|
+
});
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
// Create new user with all associated data
|
|
@@ -262,6 +268,7 @@ const checkIfUserExists = async accountId => {
|
|
|
262
268
|
id: uuidv4(),
|
|
263
269
|
})
|
|
264
270
|
.then(theme => {
|
|
271
|
+
console.log('Created theme:', theme);
|
|
265
272
|
defaultTheme = theme;
|
|
266
273
|
return theme;
|
|
267
274
|
})
|
|
@@ -279,6 +286,7 @@ const checkIfUserExists = async accountId => {
|
|
|
279
286
|
userGlobalStyles: userGlobalStyles?._id,
|
|
280
287
|
theme: defaultTheme ? [defaultTheme._id] : undefined,
|
|
281
288
|
});
|
|
289
|
+
console.log('Created user with theme:', newUser.theme);
|
|
282
290
|
|
|
283
291
|
// Create folders if schema available
|
|
284
292
|
if (folderSchema) {
|
|
@@ -289,7 +297,10 @@ const checkIfUserExists = async accountId => {
|
|
|
289
297
|
return userSchema
|
|
290
298
|
.findById(newUser._id)
|
|
291
299
|
.populate('userGlobalStyles')
|
|
292
|
-
.populate(
|
|
300
|
+
.populate({
|
|
301
|
+
path: 'theme',
|
|
302
|
+
model: 'Theme',
|
|
303
|
+
});
|
|
293
304
|
} catch (error) {
|
|
294
305
|
console.error('Error in checkIfUserExists:', {
|
|
295
306
|
accountId,
|