summary refs log tree commit diff
path: root/api/src/routes/auth/register.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-02 21:31:44 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-02 21:31:44 +0200
commit11af8531cce8cc5080f068b1677634c6027a7d72 (patch)
tree41523c621addea9984320967ec71ecadb826061d /api/src/routes/auth/register.ts
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-11af8531cce8cc5080f068b1677634c6027a7d72.tar.xz
:bug: fix entity missing an id (replace .insert with new Entity().save)
Diffstat (limited to 'api/src/routes/auth/register.ts')
-rw-r--r--api/src/routes/auth/register.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts
index 8bcecda1..19c9c70f 100644
--- a/api/src/routes/auth/register.ts
+++ b/api/src/routes/auth/register.ts
@@ -181,7 +181,7 @@ router.post(
 		// appearently discord doesn't save the date of birth and just calculate if nsfw is allowed
 		// if nsfw_allowed is null/undefined it'll require date_of_birth to set it to true/false
 
-		const user = {
+		const user = await new User({
 			created_at: new Date(),
 			username: adjusted_username,
 			discriminator,
@@ -207,8 +207,7 @@ router.post(
 			},
 			settings: defaultSettings,
 			fingerprints: []
-		};
-		await User.insert(user);
+		}).save();
 
 		return res.json({ token: await generateToken(user.id) });
 	}