diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-22 08:37:10 +0100 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-22 08:37:10 +0100 |
commit | eb181ae41decf2f985ef55ddad1548ab32ea615a (patch) | |
tree | c0b38b4c0dd60c7e2c51794dec6ecce2b0cf8b48 /src/routes | |
parent | :bug: fix Event Emitter (diff) | |
download | server-eb181ae41decf2f985ef55ddad1548ab32ea615a.tar.xz |
:pencil: #CHANNELID -> #channelid
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/api/v8/auth/login.ts | 2 | ||||
-rw-r--r-- | src/routes/api/v8/auth/register.ts | 2 | ||||
-rw-r--r-- | src/routes/api/v8/channels/#CHANNELID/invites.ts | 8 | ||||
-rw-r--r-- | src/routes/api/v8/guilds/index.ts | 2 | ||||
-rw-r--r-- | src/routes/api/v8/users/@me/guilds.ts | 24 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/routes/api/v8/auth/login.ts b/src/routes/api/v8/auth/login.ts index acdac1ce..68367120 100644 --- a/src/routes/api/v8/auth/login.ts +++ b/src/routes/api/v8/auth/login.ts @@ -2,7 +2,7 @@ import { Request, Response, Router } from "express"; import { check, FieldErrors, Length } from "../../../../util/instanceOf"; import bcrypt from "bcrypt"; import jwt from "jsonwebtoken"; -import { User, UserModel } from "fosscord-server-util"; +import { User, UserModel } from "../channels/#channelid/node_modules/fosscord-server-util"; import Config from "../../../../util/Config"; import { adjustEmail } from "./register"; diff --git a/src/routes/api/v8/auth/register.ts b/src/routes/api/v8/auth/register.ts index 1205c462..c73210c5 100644 --- a/src/routes/api/v8/auth/register.ts +++ b/src/routes/api/v8/auth/register.ts @@ -1,6 +1,6 @@ import { Request, Response, Router } from "express"; import Config from "../../../../util/Config"; -import { trimSpecial, User, Snowflake, UserModel } from "fosscord-server-util"; +import { trimSpecial, User, Snowflake, UserModel } from "../channels/#channelid/node_modules/fosscord-server-util"; import bcrypt from "bcrypt"; import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../../../util/instanceOf"; import "missing-native-js-functions"; diff --git a/src/routes/api/v8/channels/#CHANNELID/invites.ts b/src/routes/api/v8/channels/#CHANNELID/invites.ts index ae9940d0..ee71d1ee 100644 --- a/src/routes/api/v8/channels/#CHANNELID/invites.ts +++ b/src/routes/api/v8/channels/#CHANNELID/invites.ts @@ -1,11 +1,11 @@ import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { check } from "./../../../../../util/instanceOf"; -import { random } from "./../../../../../util/RandomInviteID"; +import { check } from "../../../../../util/instanceOf"; +import { random } from "../../../../../util/RandomInviteID"; import { emitEvent } from "../../../../../util/Event"; -import { InviteCreateSchema } from "./../../../../../schema/Invite"; +import { InviteCreateSchema } from "../../../../../schema/Invite"; import { getPermission, ChannelModel, InviteModel, InviteCreateEvent } from "fosscord-server-util"; @@ -13,7 +13,7 @@ const router: Router = Router(); router.post("/", check(InviteCreateSchema), async (req: Request, res: Response) => { const usID = req.userid; - const chID = BigInt(req.params.CHANNELID); + const chID = BigInt(req.params.channelid); const channel = await ChannelModel.findOne({ id: chID }).exec(); if (!channel || !channel.guild_id) { diff --git a/src/routes/api/v8/guilds/index.ts b/src/routes/api/v8/guilds/index.ts index 95a2a8b4..a4d53e73 100644 --- a/src/routes/api/v8/guilds/index.ts +++ b/src/routes/api/v8/guilds/index.ts @@ -17,7 +17,7 @@ import { Ban, GuildBanAddEvent, GuildBanRemoveEvent, -} from "fosscord-server-util"; +} from "../channels/#channelid/node_modules/fosscord-server-util"; import { HTTPError } from "lambert-server"; import { check } from "./../../../../util/instanceOf"; import { GuildCreateSchema, GuildUpdateSchema } from "../../../../schema/Guild"; diff --git a/src/routes/api/v8/users/@me/guilds.ts b/src/routes/api/v8/users/@me/guilds.ts index d7c1bc25..e205f6ec 100644 --- a/src/routes/api/v8/users/@me/guilds.ts +++ b/src/routes/api/v8/users/@me/guilds.ts @@ -4,8 +4,8 @@ import { MemberModel, UserModel, GuildDeleteEvent, - GuildMemberRemoveEvent -} from "fosscord-server-util"; + GuildMemberRemoveEvent, +} from "../../channels/#channelid/node_modules/fosscord-server-util"; import { HTTPError } from "lambert-server"; import { emitEvent } from "../../../../../util/Event"; @@ -17,36 +17,36 @@ router.get("/", async (req: Request, res: Response) => { "guilds username discriminator id public_flags avatar" ).exec(); - if (!user) throw new HTTPError("User not found", 404); + if (!user) throw new HTTPError("User not found", 404); var guildIDs = user.guilds || []; var guildsss = await GuildModel.find({ id: { $in: guildIDs } }).exec(); - res.json(guildsss) + res.json(guildsss); }); router.delete("/:id", async (req: Request, res: Response) => { const guildID = BigInt(req.params.id); - if(await GuildModel.findOne({id: guildID, owner_id: req.userid}).exec()) throw new HTTPError("You can't leave your own guild", 400); - var user = await UserModel.findOneAndUpdate({ id: req.userid}, { $pull: { guilds: guildID }}).exec(); - await MemberModel.deleteOne({ id: req.userid, guild_id: guildID}).exec(); + if (await GuildModel.findOne({ id: guildID, owner_id: req.userid }).exec()) + throw new HTTPError("You can't leave your own guild", 400); + var user = await UserModel.findOneAndUpdate({ id: req.userid }, { $pull: { guilds: guildID } }).exec(); + await MemberModel.deleteOne({ id: req.userid, guild_id: guildID }).exec(); await emitEvent({ event: "GUILD_DELETE", data: { - id: guildID + id: guildID, }, - user_id: req.userid + user_id: req.userid, } as GuildDeleteEvent); await emitEvent({ event: "GUILD_MEMBER_REMOVE", data: { guild_id: guildID, - user: user + user: user, }, - guild_id: guildID + guild_id: guildID, } as GuildMemberRemoveEvent); - return res.status(204).send(); }); |