summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-12 10:37:42 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-13 21:57:51 +0200
commitdd0a6e9709a8b8a8d18b0a8d85c3a2a2b4921ba5 (patch)
treead75fdae74e89f43cd3b1218903d35d3ab9331fd
parentFix updated client stuff... (diff)
downloadserver-dd0a6e9709a8b8a8d18b0a8d85c3a2a2b4921ba5.tar.xz
Move some invite defaults into class
-rw-r--r--api/src/routes/channels/#channel_id/invites.ts6
1 files changed, 1 insertions, 5 deletions
diff --git a/api/src/routes/channels/#channel_id/invites.ts b/api/src/routes/channels/#channel_id/invites.ts
index c0279f49..f111cf54 100644
--- a/api/src/routes/channels/#channel_id/invites.ts
+++ b/api/src/routes/channels/#channel_id/invites.ts
@@ -35,15 +35,12 @@ router.post("/", route({ body: "InviteCreateSchema", permission: "CREATE_INSTANT
 	const expires_at = new Date(req.body.max_age * 1000 + Date.now());
 
 	const invite = await OrmUtils.mergeDeep(new Invite(),{
-		code: random(),
 		temporary: req.body.temporary || true,
-		uses: 0,
 		max_uses: req.body.max_uses,
 		max_age: req.body.max_age,
 		expires_at,
-		created_at: new Date(),
 		guild_id,
-		channel_id: channel_id,
+		channel_id,
 		inviter_id: user_id
 	}).save();
 	//TODO: check this, removed toJSON call
@@ -57,7 +54,6 @@ router.post("/", route({ body: "InviteCreateSchema", permission: "CREATE_INSTANT
 });
 
 router.get("/", route({ permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => {
-	const { user_id } = req;
 	const { channel_id } = req.params;
 	const channel = await Channel.findOneOrFail({ where: { id: channel_id } });