From 181afe7e09292f49a86f9794f9675f723378c57b Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 18 Sep 2021 00:19:53 +0200 Subject: :bug: fix guild create icon --- api/src/routes/guilds/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'api/src/routes/guilds/index.ts') diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts index 2e68d953..3612ca82 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts @@ -1,6 +1,6 @@ import { Router, Request, Response } from "express"; import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util"; -import { route } from "@fosscord/api"; +import { handleFile, route } from "@fosscord/api"; import { DiscordApiErrors } from "@fosscord/util"; import { ChannelModifySchema } from "../channels/#channel_id"; @@ -34,6 +34,7 @@ router.post("/", route({ body: "GuildCreateSchema" }), async (req: Request, res: await Guild.insert({ name: body.name, + icon: await handleFile(`/icons/${guild_id}`, body.icon as string), region: Config.get().regions.default, owner_id: req.user_id, afk_timeout: 300, -- cgit 1.5.1 From c50648ddccfef4f06dbd46fb8aaede9f9709e6e8 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 19 Sep 2021 18:44:49 +0200 Subject: :truck: move handleFile to cdn --- api/src/routes/channels/#channel_id/messages/index.ts | 3 +-- api/src/routes/guilds/#guild_id/index.ts | 3 +-- api/src/routes/guilds/index.ts | 5 ++--- api/src/routes/users/@me/index.ts | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'api/src/routes/guilds/index.ts') diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index ec93649e..07bfc22d 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -1,10 +1,9 @@ import { Router, Response, Request } from "express"; -import { Attachment, Channel, ChannelType, Embed, getPermission, Message } from "@fosscord/util"; +import { Attachment, Channel, ChannelType, Embed, getPermission, Message, uploadFile } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { route } from "@fosscord/api"; import multer from "multer"; import { sendMessage } from "@fosscord/api"; -import { uploadFile } from "@fosscord/api"; import { FindManyOptions, LessThan, MoreThan } from "typeorm"; const router: Router = Router(); diff --git a/api/src/routes/guilds/#guild_id/index.ts b/api/src/routes/guilds/#guild_id/index.ts index 63000b84..d8ee86ff 100644 --- a/api/src/routes/guilds/#guild_id/index.ts +++ b/api/src/routes/guilds/#guild_id/index.ts @@ -1,8 +1,7 @@ import { Request, Response, Router } from "express"; -import { emitEvent, getPermission, Guild, GuildUpdateEvent, Member } from "@fosscord/util"; +import { emitEvent, getPermission, Guild, GuildUpdateEvent, handleFile, Member } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { route } from "@fosscord/api"; -import { handleFile } from "@fosscord/api"; import "missing-native-js-functions"; import { GuildCreateSchema } from "../index"; diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts index 3612ca82..abde147d 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts @@ -1,7 +1,6 @@ import { Router, Request, Response } from "express"; -import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util"; -import { handleFile, route } from "@fosscord/api"; -import { DiscordApiErrors } from "@fosscord/util"; +import { Role, Guild, Snowflake, Config, Member, Channel, DiscordApiErrors, handleFile } from "@fosscord/util"; +import { route } from "@fosscord/api"; import { ChannelModifySchema } from "../channels/#channel_id"; const router: Router = Router(); diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index da2f3348..835aab4d 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -1,7 +1,6 @@ import { Router, Request, Response } from "express"; -import { User, PrivateUserProjection, emitEvent, UserUpdateEvent } from "@fosscord/util"; +import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile } from "@fosscord/util"; import { route } from "@fosscord/api"; -import { handleFile } from "@fosscord/api"; const router: Router = Router(); -- cgit 1.5.1