diff --git a/src/api/routes/oauth2/applications/@me.ts b/src/api/routes/oauth2/applications/@me.ts
index 0c23bdb1..3c404d25 100644
--- a/src/api/routes/oauth2/applications/@me.ts
+++ b/src/api/routes/oauth2/applications/@me.ts
@@ -17,11 +17,7 @@
*/
import { route } from "@spacebar/api";
-import {
- Application,
- DiscordApiErrors,
- PublicUserProjection,
-} from "@spacebar/util";
+import { Application, DiscordApiErrors, PublicUserProjection } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router: Router = Router();
@@ -40,9 +36,7 @@ router.get(
where: { id: req.params.id },
relations: ["bot", "owner"],
select: {
- owner: Object.fromEntries(
- PublicUserProjection.map((x) => [x, true]),
- ),
+ owner: Object.fromEntries(PublicUserProjection.map((x) => [x, true])),
},
});
@@ -51,9 +45,8 @@ router.get(
res.json({
...app,
owner: app.owner.toPublicUser(),
- install_params:
- app.install_params !== null ? app.install_params : undefined,
+ install_params: app.install_params !== null ? app.install_params : undefined,
});
- },
+ }
);
export default router;
diff --git a/src/api/routes/oauth2/authorize.ts b/src/api/routes/oauth2/authorize.ts
index 2f2351f3..bdb12455 100644
--- a/src/api/routes/oauth2/authorize.ts
+++ b/src/api/routes/oauth2/authorize.ts
@@ -84,13 +84,7 @@ router.get(
id: req.user_id,
bot: false,
},
- select: [
- "id",
- "username",
- "avatar",
- "discriminator",
- "public_flags",
- ],
+ select: ["id", "username", "avatar", "discriminator", "public_flags"],
});
const guilds = await Member.find({
@@ -165,7 +159,7 @@ router.get(
},
authorized: false,
});
- },
+ }
);
router.post(
@@ -210,17 +204,9 @@ router.post(
// TODO: captcha verification
// TODO: MFA verification
- const perms = await getPermission(
- req.user_id,
- body.guild_id,
- undefined,
- { member_relations: ["user"] },
- );
+ const perms = await getPermission(req.user_id, body.guild_id, undefined, { member_relations: ["user"] });
// getPermission cache won't exist if we're owner
- if (
- Object.keys(perms.cache || {}).length > 0 &&
- perms.cache.member?.user.bot
- )
+ if (Object.keys(perms.cache || {}).length > 0 && perms.cache.member?.user.bot)
throw DiscordApiErrors.UNAUTHORIZED;
perms.hasThrow("MANAGE_GUILD");
@@ -234,19 +220,14 @@ router.post(
// TODO: use DiscordApiErrors
// findOneOrFail throws code 404
if (!app) throw new ApiError("Unknown Application", 10002, 404);
- if (!app.bot)
- throw new ApiError(
- "OAuth2 application does not have a bot",
- 50010,
- 400,
- );
+ if (!app.bot) throw new ApiError("OAuth2 application does not have a bot", 50010, 400);
await Member.addToGuild(app.id, body.guild_id);
return res.json({
location: "/oauth2/authorized", // redirect URL
});
- },
+ }
);
export default router;
|