summary refs log tree commit diff
path: root/util/src/entities/User.ts
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/entities/User.ts')
-rw-r--r--util/src/entities/User.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts
index 97564af3..662ab031 100644
--- a/util/src/entities/User.ts
+++ b/util/src/entities/User.ts
@@ -198,7 +198,7 @@ export class User extends BaseClass {
 		// randomly generates a discriminator between 1 and 9999 and checks max five times if it already exists
 		// if it all five times already exists, abort with USERNAME_TOO_MANY_USERS error
 		// else just continue
-		// TODO: is there any better way to generate a random discriminator only once, without checking if it already exists in the mongodb database?
+		// TODO: is there any better way to generate a random discriminator only once, without checking if it already exists in the database?
 		for (let tries = 0; tries < 5; tries++) {
 			discriminator = Math.randomIntBetween(1, 9999).toString().padStart(4, "0");
 			exists = await User.findOne({ where: { discriminator, username: username }, select: ["id"] });
@@ -219,7 +219,7 @@ export class User extends BaseClass {
 		// if nsfw_allowed is null/undefined it'll require date_of_birth to set it to true/false
 		const language = req.language === "en" ? "en-US" : req.language || "en-US";
 
-		const user = await new User({
+		const user = new User({
 			created_at: new Date(),
 			username: username,
 			discriminator,
@@ -246,7 +246,10 @@ export class User extends BaseClass {
 			},
 			settings: { ...defaultSettings, locale: language },
 			fingerprints: [],
-		}).save();
+		});
+
+		console.log(user);
+		await user.save();
 
 		if (Config.get().guild.autoJoin.enabled) {
 			for (const guild of Config.get().guild.autoJoin.guilds || []) {