propro-utils 1.5.46 → 1.5.47
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.
|
@@ -137,17 +137,19 @@ const checkIfUserExists = async accountId => {
|
|
|
137
137
|
accountId
|
|
138
138
|
);
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
console.log('Folders created:', folders);
|
|
142
|
-
user.folders = folders;
|
|
143
|
-
await user.save();
|
|
144
|
-
|
|
145
|
-
return await userSchema.create({
|
|
140
|
+
user = await userSchema.create({
|
|
146
141
|
accountId,
|
|
147
142
|
id: uuidv4(),
|
|
148
143
|
verified: false,
|
|
149
144
|
userGlobalStyles: userGlobalStyles._id,
|
|
150
145
|
});
|
|
146
|
+
|
|
147
|
+
const folders = await createDefaultFolders(folderSchema, accountId);
|
|
148
|
+
console.log('Folders created:', folders);
|
|
149
|
+
user.folders = folders.map(folder => folder._id);
|
|
150
|
+
await user.save();
|
|
151
|
+
|
|
152
|
+
return user;
|
|
151
153
|
} catch (error) {
|
|
152
154
|
console.error('Error in checkIfUserExists:', error);
|
|
153
155
|
throw new Error('Failed to get or create user');
|