diff options
Diffstat (limited to 'api/src/routes')
40 files changed, 81 insertions, 71 deletions
diff --git a/api/src/routes/auth/login.ts b/api/src/routes/auth/login.ts index c3661608..f55d5351 100644 --- a/api/src/routes/auth/login.ts +++ b/api/src/routes/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 { Config, UserModel } from "@fosscord/server-util"; +import { Config, UserModel } from "@fosscord/util"; import { adjustEmail } from "./register"; import RateLimit from "../../middlewares/RateLimit"; diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts index 66a1fc8d..fecde874 100644 --- a/api/src/routes/auth/register.ts +++ b/api/src/routes/auth/register.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { trimSpecial, User, Snowflake, UserModel, Config } from "@fosscord/server-util"; +import { trimSpecial, User, Snowflake, UserModel, Config } from "@fosscord/util"; import bcrypt from "bcrypt"; import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf"; import "missing-native-js-functions"; diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts index 81e5054e..3bfa80be 100644 --- a/api/src/routes/channels/#channel_id/index.ts +++ b/api/src/routes/channels/#channel_id/index.ts @@ -1,8 +1,7 @@ -import { ChannelDeleteEvent, ChannelModel, ChannelUpdateEvent, getPermission, GuildUpdateEvent, toObject } from "@fosscord/server-util"; +import { ChannelDeleteEvent, ChannelModel, ChannelUpdateEvent, emitEvent, getPermission, GuildUpdateEvent, toObject } from "@fosscord/util"; import { Router, Response, Request } from "express"; import { HTTPError } from "lambert-server"; import { ChannelModifySchema } from "../../../schema/Channel"; -import { emitEvent } from "../../../util/Event"; import { check } from "../../../util/instanceOf"; const router: Router = Router(); // TODO: delete channel diff --git a/api/src/routes/channels/#channel_id/invites.ts b/api/src/routes/channels/#channel_id/invites.ts index c9db4dd2..438f8c51 100644 --- a/api/src/routes/channels/#channel_id/invites.ts +++ b/api/src/routes/channels/#channel_id/invites.ts @@ -3,11 +3,10 @@ import { HTTPError } from "lambert-server"; import { check } from "../../../util/instanceOf"; import { random } from "../../../util/RandomInviteID"; -import { emitEvent } from "../../../util/Event"; import { InviteCreateSchema } from "../../../schema/Invite"; -import { getPermission, ChannelModel, InviteModel, InviteCreateEvent, toObject } from "@fosscord/server-util"; +import { getPermission, ChannelModel, InviteModel, InviteCreateEvent, toObject, emitEvent } from "@fosscord/util"; const router: Router = Router(); diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts index f4d9e696..bbc779dd 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts @@ -1,6 +1,6 @@ -import { getPermission, MessageAckEvent, ReadStateModel } from "@fosscord/server-util"; +import { emitEvent, getPermission, MessageAckEvent, ReadStateModel } from "@fosscord/util"; import { Request, Response, Router } from "express"; -import { emitEvent } from "../../../../../util/Event"; + import { check } from "../../../../../util/instanceOf"; const router = Router(); diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts index a7c23d2f..3c58d034 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts @@ -1,8 +1,8 @@ -import { ChannelModel, getPermission, MessageDeleteEvent, MessageModel, MessageUpdateEvent, toObject } from "@fosscord/server-util"; +import { ChannelModel, emitEvent, getPermission, MessageDeleteEvent, MessageModel, MessageUpdateEvent, toObject } from "@fosscord/util"; import { Router, Response, Request } from "express"; import { HTTPError } from "lambert-server"; import { MessageCreateSchema } from "../../../../../schema/Message"; -import { emitEvent } from "../../../../../util/Event"; + import { check } from "../../../../../util/instanceOf"; import { handleMessage, postHandleMessage } from "../../../../../util/Message"; diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/reactions.ts b/api/src/routes/channels/#channel_id/messages/#message_id/reactions.ts index 168a870f..34d2ce3a 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/reactions.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/reactions.ts @@ -1,5 +1,6 @@ import { ChannelModel, + emitEvent, EmojiModel, getPermission, MemberModel, @@ -12,10 +13,9 @@ import { PublicUserProjection, toObject, UserModel -} from "@fosscord/server-util"; +} from "@fosscord/util"; import { Router, Response, Request } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../../../util/Event"; const router = Router(); // TODO: check if emoji is really an unicode emoji or a prperly encoded external emoji diff --git a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts index e53cd597..8132462f 100644 --- a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts +++ b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts @@ -1,7 +1,7 @@ import { Router, Response, Request } from "express"; -import { ChannelModel, Config, getPermission, MessageDeleteBulkEvent, MessageModel } from "@fosscord/server-util"; +import { ChannelModel, Config, emitEvent, getPermission, MessageDeleteBulkEvent, MessageModel } from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../../util/Event"; + import { check } from "../../../../util/instanceOf"; const router: Router = Router(); diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index fea4d6a4..6ae6491f 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -1,5 +1,5 @@ import { Router, Response, Request } from "express"; -import { Attachment, ChannelModel, ChannelType, getPermission, MessageDocument, MessageModel, toObject } from "@fosscord/server-util"; +import { Attachment, ChannelModel, ChannelType, getPermission, MessageDocument, MessageModel, toObject } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { MessageCreateSchema } from "../../../../schema/Message"; import { check, instanceOf, Length } from "../../../../util/instanceOf"; diff --git a/api/src/routes/channels/#channel_id/permissions.ts b/api/src/routes/channels/#channel_id/permissions.ts index 12364293..4cbc7522 100644 --- a/api/src/routes/channels/#channel_id/permissions.ts +++ b/api/src/routes/channels/#channel_id/permissions.ts @@ -1,7 +1,15 @@ -import { ChannelModel, ChannelPermissionOverwrite, ChannelUpdateEvent, getPermission, MemberModel, RoleModel } from "@fosscord/server-util"; +import { + ChannelModel, + ChannelPermissionOverwrite, + ChannelUpdateEvent, + emitEvent, + getPermission, + MemberModel, + RoleModel +} from "@fosscord/util"; import { Router, Response, Request } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; const router: Router = Router(); diff --git a/api/src/routes/channels/#channel_id/pins.ts b/api/src/routes/channels/#channel_id/pins.ts index 65d6b975..18a5861b 100644 --- a/api/src/routes/channels/#channel_id/pins.ts +++ b/api/src/routes/channels/#channel_id/pins.ts @@ -2,14 +2,14 @@ import { ChannelModel, ChannelPinsUpdateEvent, Config, + emitEvent, getPermission, MessageModel, MessageUpdateEvent, toObject -} from "@fosscord/server-util"; +} from "@fosscord/util"; import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; const router: Router = Router(); diff --git a/api/src/routes/channels/#channel_id/typing.ts b/api/src/routes/channels/#channel_id/typing.ts index de549883..21d453d8 100644 --- a/api/src/routes/channels/#channel_id/typing.ts +++ b/api/src/routes/channels/#channel_id/typing.ts @@ -1,8 +1,7 @@ -import { ChannelModel, MemberModel, toObject, TypingStartEvent } from "@fosscord/server-util"; +import { ChannelModel, emitEvent, MemberModel, toObject, TypingStartEvent } from "@fosscord/util"; import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; const router: Router = Router(); diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts index 6c1aea2a..7852f8f3 100644 --- a/api/src/routes/channels/#channel_id/webhooks.ts +++ b/api/src/routes/channels/#channel_id/webhooks.ts @@ -1,6 +1,6 @@ import { Router, Response, Request } from "express"; import { check, Length } from "../../../util/instanceOf"; -import { ChannelModel, getPermission, trimSpecial } from "@fosscord/server-util"; +import { ChannelModel, getPermission, trimSpecial } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { isTextChannel } from "./messages/index"; diff --git a/api/src/routes/gateway.ts b/api/src/routes/gateway.ts index f2bc5b34..3120718e 100644 --- a/api/src/routes/gateway.ts +++ b/api/src/routes/gateway.ts @@ -1,4 +1,4 @@ -import { Config } from "@fosscord/server-util"; +import { Config } from "@fosscord/util"; import { Router, Response, Request } from "express"; const router = Router(); diff --git a/api/src/routes/guilds/#guild_id/bans.ts b/api/src/routes/guilds/#guild_id/bans.ts index d9752f61..bb3eac03 100644 --- a/api/src/routes/guilds/#guild_id/bans.ts +++ b/api/src/routes/guilds/#guild_id/bans.ts @@ -1,9 +1,9 @@ import { Request, Response, Router } from "express"; -import { BanModel, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel, toObject } from "@fosscord/server-util"; +import { BanModel, emitEvent, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel, toObject } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { getIpAdress } from "../../../util/ipAddress"; import { BanCreateSchema } from "../../../schema/Ban"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; import { removeMember } from "../../../util/Member"; import { getPublicUser } from "../../../util/User"; diff --git a/api/src/routes/guilds/#guild_id/channels.ts b/api/src/routes/guilds/#guild_id/channels.ts index 52361f5e..8d97cf96 100644 --- a/api/src/routes/guilds/#guild_id/channels.ts +++ b/api/src/routes/guilds/#guild_id/channels.ts @@ -8,11 +8,12 @@ import { toObject, ChannelUpdateEvent, AnyChannel, - getPermission -} from "@fosscord/server-util"; + getPermission, + emitEvent +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { ChannelModifySchema } from "../../../schema/Channel"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; import { createChannel } from "../../../util/Channel"; const router = Router(); @@ -64,7 +65,7 @@ router.patch( const channel = await ChannelModel.findOneAndUpdate({ id: req.body, guild_id }, opts).exec(); - await emitEvent({ event: "CHANNEL_UPDATE", data: channel, channel_id: body.id, guild_id } as ChannelUpdateEvent); + await emitEvent({ event: "CHANNEL_UPDATE", data: toObject(channel), channel_id: body.id, guild_id } as ChannelUpdateEvent); res.json(toObject(channel)); } diff --git a/api/src/routes/guilds/#guild_id/delete.ts b/api/src/routes/guilds/#guild_id/delete.ts index 6cca289e..ba1c2fde 100644 --- a/api/src/routes/guilds/#guild_id/delete.ts +++ b/api/src/routes/guilds/#guild_id/delete.ts @@ -1,5 +1,6 @@ import { ChannelModel, + emitEvent, EmojiModel, GuildDeleteEvent, GuildModel, @@ -8,10 +9,9 @@ import { MessageModel, RoleModel, UserModel -} from "@fosscord/server-util"; +} from "@fosscord/util"; import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; const router = Router(); diff --git a/api/src/routes/guilds/#guild_id/index.ts b/api/src/routes/guilds/#guild_id/index.ts index dc4ddb39..1afa603f 100644 --- a/api/src/routes/guilds/#guild_id/index.ts +++ b/api/src/routes/guilds/#guild_id/index.ts @@ -1,6 +1,7 @@ import { Request, Response, Router } from "express"; import { ChannelModel, + emitEvent, EmojiModel, getPermission, GuildDeleteEvent, @@ -12,10 +13,10 @@ import { RoleModel, toObject, UserModel -} from "@fosscord/server-util"; +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { GuildUpdateSchema } from "../../../schema/Guild"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; import { handleFile } from "../../../util/cdn"; import "missing-native-js-functions"; diff --git a/api/src/routes/guilds/#guild_id/invites.ts b/api/src/routes/guilds/#guild_id/invites.ts index 1894ec96..08048d61 100644 --- a/api/src/routes/guilds/#guild_id/invites.ts +++ b/api/src/routes/guilds/#guild_id/invites.ts @@ -1,4 +1,4 @@ -import { getPermission, InviteModel, toObject } from "@fosscord/server-util"; +import { getPermission, InviteModel, toObject } from "@fosscord/util"; import { Request, Response, Router } from "express"; const router = Router(); diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts index 9a1676e6..eac6684a 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts @@ -8,13 +8,13 @@ import { getPermission, PermissionResolvable, RoleModel, - GuildMemberUpdateEvent -} from "@fosscord/server-util"; + GuildMemberUpdateEvent, + emitEvent +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { addMember, isMember, removeMember } from "../../../../../util/Member"; import { check } from "../../../../../util/instanceOf"; import { MemberChangeSchema } from "../../../../../schema/Member"; -import { emitEvent } from "../../../../../util/Event"; const router = Router(); diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/nick.ts b/api/src/routes/guilds/#guild_id/members/#member_id/nick.ts index 77b8d72a..e4308364 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/nick.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/nick.ts @@ -1,4 +1,4 @@ -import { getPermission, PermissionResolvable } from "@fosscord/server-util"; +import { getPermission, PermissionResolvable } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { check } from "lambert-server"; import { MemberNickChangeSchema } from "../../../../../schema/Member"; diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/roles/#role_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/roles/#role_id/index.ts index b7a43c74..fad0695e 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/roles/#role_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/roles/#role_id/index.ts @@ -1,4 +1,4 @@ -import { getPermission } from "@fosscord/server-util"; +import { getPermission } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { addRole, removeRole } from "../../../../../../../util/Member"; diff --git a/api/src/routes/guilds/#guild_id/members/index.ts b/api/src/routes/guilds/#guild_id/members/index.ts index a157d8f5..70303436 100644 --- a/api/src/routes/guilds/#guild_id/members/index.ts +++ b/api/src/routes/guilds/#guild_id/members/index.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { GuildModel, MemberModel, toObject } from "@fosscord/server-util"; +import { GuildModel, MemberModel, toObject } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { instanceOf, Length } from "../../../../util/instanceOf"; import { PublicMemberProjection, isMember } from "../../../../util/Member"; diff --git a/api/src/routes/guilds/#guild_id/regions.ts b/api/src/routes/guilds/#guild_id/regions.ts index 3a46d766..5ec649ee 100644 --- a/api/src/routes/guilds/#guild_id/regions.ts +++ b/api/src/routes/guilds/#guild_id/regions.ts @@ -1,4 +1,4 @@ -import { Config } from "@fosscord/server-util"; +import { Config } from "@fosscord/util"; import { Request, Response, Router } from "express"; const router = Router(); @@ -7,4 +7,4 @@ router.get("/", async (req: Request, res: Response) => { return res.json(Config.get().regions.available); }); -export default router; \ No newline at end of file +export default router; diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts index 77206a0f..a4bc44e0 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts @@ -9,10 +9,11 @@ import { MemberModel, GuildRoleCreateEvent, GuildRoleUpdateEvent, - GuildRoleDeleteEvent -} from "@fosscord/server-util"; + GuildRoleDeleteEvent, + emitEvent +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; import { RoleModifySchema } from "../../../schema/Roles"; import { getPublicUser } from "../../../util/User"; diff --git a/api/src/routes/guilds/#guild_id/templates.ts b/api/src/routes/guilds/#guild_id/templates.ts index 8306ac37..fdca1c40 100644 --- a/api/src/routes/guilds/#guild_id/templates.ts +++ b/api/src/routes/guilds/#guild_id/templates.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { TemplateModel, GuildModel, getPermission, toObject, UserModel, Snowflake } from "@fosscord/server-util"; +import { TemplateModel, GuildModel, getPermission, toObject, UserModel, Snowflake } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { TemplateCreateSchema, TemplateModifySchema } from "../../../schema/Template"; import { check } from "../../../util/instanceOf"; diff --git a/api/src/routes/guilds/#guild_id/vanity-url.ts b/api/src/routes/guilds/#guild_id/vanity-url.ts index 323b2647..86adfeb0 100644 --- a/api/src/routes/guilds/#guild_id/vanity-url.ts +++ b/api/src/routes/guilds/#guild_id/vanity-url.ts @@ -1,4 +1,4 @@ -import { getPermission, GuildModel, InviteModel, trimSpecial } from "@fosscord/server-util"; +import { getPermission, GuildModel, InviteModel, trimSpecial } from "@fosscord/util"; import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; import { check, Length } from "../../../util/instanceOf"; diff --git a/api/src/routes/guilds/#guild_id/welcome_screen.ts b/api/src/routes/guilds/#guild_id/welcome_screen.ts index 656a0ee0..c717042e 100644 --- a/api/src/routes/guilds/#guild_id/welcome_screen.ts +++ b/api/src/routes/guilds/#guild_id/welcome_screen.ts @@ -1,7 +1,7 @@ import { Request, Response, Router } from "express"; -import { GuildModel, getPermission, toObject, Snowflake } from "@fosscord/server-util"; +import { GuildModel, getPermission, toObject, Snowflake } from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { check } from "../../../util/instanceOf"; import { isMember } from "../../../util/Member"; import { GuildAddChannelToWelcomeScreenSchema } from "../../../schema/Guild"; diff --git a/api/src/routes/guilds/#guild_id/widget.json.ts b/api/src/routes/guilds/#guild_id/widget.json.ts index 6f777ab4..8719bd85 100644 --- a/api/src/routes/guilds/#guild_id/widget.json.ts +++ b/api/src/routes/guilds/#guild_id/widget.json.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { Config, Permissions, GuildModel, InviteModel, ChannelModel, MemberModel } from "@fosscord/server-util"; +import { Config, Permissions, GuildModel, InviteModel, ChannelModel, MemberModel } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { random } from "../../../util/RandomInviteID"; diff --git a/api/src/routes/guilds/#guild_id/widget.png.ts b/api/src/routes/guilds/#guild_id/widget.png.ts index a0a8c938..80dc9f2b 100644 --- a/api/src/routes/guilds/#guild_id/widget.png.ts +++ b/api/src/routes/guilds/#guild_id/widget.png.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { GuildModel } from "@fosscord/server-util"; +import { GuildModel } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import fs from "fs"; import path from "path"; diff --git a/api/src/routes/guilds/#guild_id/widget.ts b/api/src/routes/guilds/#guild_id/widget.ts index 0e6df186..85eed5e9 100644 --- a/api/src/routes/guilds/#guild_id/widget.ts +++ b/api/src/routes/guilds/#guild_id/widget.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { getPermission, GuildModel } from "@fosscord/server-util"; +import { getPermission, GuildModel } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { check } from "../../../util/instanceOf"; import { WidgetModifySchema } from "../../../schema/Widget"; diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts index 25b55896..c97a8205 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts @@ -1,5 +1,5 @@ import { Router, Request, Response } from "express"; -import { RoleModel, GuildModel, Snowflake, Guild, RoleDocument, Config } from "@fosscord/server-util"; +import { RoleModel, GuildModel, Snowflake, Guild, RoleDocument, Config } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { check } from "./../../util/instanceOf"; import { GuildCreateSchema } from "../../schema/Guild"; diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts index 0f332de0..7fed3c5d 100644 --- a/api/src/routes/guilds/templates/index.ts +++ b/api/src/routes/guilds/templates/index.ts @@ -1,6 +1,6 @@ import { Request, Response, Router } from "express"; const router: Router = Router(); -import { TemplateModel, GuildModel, toObject, UserModel, RoleModel, Snowflake, Guild, Config } from "@fosscord/server-util"; +import { TemplateModel, GuildModel, toObject, UserModel, RoleModel, Snowflake, Guild, Config } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { GuildTemplateCreateSchema } from "../../../schema/Guild"; import { getPublicUser } from "../../../util/User"; diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts index 8c04713c..992694df 100644 --- a/api/src/routes/invites/index.ts +++ b/api/src/routes/invites/index.ts @@ -1,5 +1,5 @@ import { Router, Request, Response } from "express"; -import { getPermission, InviteModel, toObject } from "@fosscord/server-util"; +import { getPermission, InviteModel, toObject } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { addMember } from "../../util/Member"; const router: Router = Router(); diff --git a/api/src/routes/users/@me/channels.ts b/api/src/routes/users/@me/channels.ts index a425a25f..db9f8832 100644 --- a/api/src/routes/users/@me/channels.ts +++ b/api/src/routes/users/@me/channels.ts @@ -8,10 +8,11 @@ import { trimSpecial, Channel, DMChannel, - UserModel -} from "@fosscord/server-util"; + UserModel, + emitEvent +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { DmChannelCreateSchema } from "../../../schema/Channel"; import { check } from "../../../util/instanceOf"; diff --git a/api/src/routes/users/@me/delete.ts b/api/src/routes/users/@me/delete.ts index edda8e2d..f863237d 100644 --- a/api/src/routes/users/@me/delete.ts +++ b/api/src/routes/users/@me/delete.ts @@ -1,5 +1,5 @@ import { Router, Request, Response } from "express"; -import { GuildModel, MemberModel, UserModel } from "@fosscord/server-util"; +import { GuildModel, MemberModel, UserModel } from "@fosscord/util"; import bcrypt from "bcrypt"; const router = Router(); diff --git a/api/src/routes/users/@me/disable.ts b/api/src/routes/users/@me/disable.ts index 0e5b734e..2d3a9850 100644 --- a/api/src/routes/users/@me/disable.ts +++ b/api/src/routes/users/@me/disable.ts @@ -1,4 +1,4 @@ -import { UserModel } from "@fosscord/server-util"; +import { UserModel } from "@fosscord/util"; import { Router, Response, Request } from "express"; import bcrypt from "bcrypt"; diff --git a/api/src/routes/users/@me/guilds.ts b/api/src/routes/users/@me/guilds.ts index 6528552b..a9b53b75 100644 --- a/api/src/routes/users/@me/guilds.ts +++ b/api/src/routes/users/@me/guilds.ts @@ -1,7 +1,7 @@ import { Router, Request, Response } from "express"; -import { GuildModel, MemberModel, UserModel, GuildDeleteEvent, GuildMemberRemoveEvent, toObject } from "@fosscord/server-util"; +import { GuildModel, MemberModel, UserModel, GuildDeleteEvent, GuildMemberRemoveEvent, toObject, emitEvent } from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { getPublicUser } from "../../../util/User"; const router: Router = Router(); @@ -32,10 +32,10 @@ router.delete("/:id", async (req: Request, res: Response) => { emitEvent({ event: "GUILD_DELETE", data: { - id: guild_id, + id: guild_id }, - user_id: req.user_id, - } as GuildDeleteEvent), + user_id: req.user_id + } as GuildDeleteEvent) ]); const user = await getPublicUser(req.user_id); @@ -44,9 +44,9 @@ router.delete("/:id", async (req: Request, res: Response) => { event: "GUILD_MEMBER_REMOVE", data: { guild_id: guild_id, - user: user, + user: user }, - guild_id: guild_id, + guild_id: guild_id } as GuildMemberRemoveEvent); return res.sendStatus(204); diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index 7bd4a486..c073e78a 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -1,5 +1,5 @@ import { Router, Request, Response } from "express"; -import { UserModel, toObject, PublicUserProjection } from "@fosscord/server-util"; +import { UserModel, toObject, PublicUserProjection } from "@fosscord/util"; import { getPublicUser } from "../../../util/User"; import { UserModifySchema } from "../../../schema/User"; import { check } from "../../../util/instanceOf"; diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts index a8f03143..642ee5f9 100644 --- a/api/src/routes/users/@me/relationships.ts +++ b/api/src/routes/users/@me/relationships.ts @@ -5,11 +5,12 @@ import { toObject, RelationshipType, RelationshipRemoveEvent, - UserDocument -} from "@fosscord/server-util"; + UserDocument, + emitEvent +} from "@fosscord/util"; import { Router, Response, Request } from "express"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "../../../util/Event"; + import { check, Length } from "../../../util/instanceOf"; const router = Router(); |