🎨 reformat
This commit is contained in:
parent
fb3f957f30
commit
bc85d6ff86
@ -78,7 +78,7 @@ export class FosscordServer extends Server {
|
||||
api.use("*", (error: any, req: Request, res: Response, next: NextFunction) => {
|
||||
if (error) return next(error);
|
||||
res.status(404).json({
|
||||
message: "404: Not Found",
|
||||
message: "404 endpoint not found",
|
||||
code: 0
|
||||
});
|
||||
next();
|
||||
|
@ -40,17 +40,14 @@ router.post("/", route({ body: "EmojiCreateSchema", permission: "MANAGE_EMOJIS_A
|
||||
const { guild_id } = req.params;
|
||||
const body = req.body as EmojiCreateSchema;
|
||||
|
||||
const id = Snowflake.generate();
|
||||
const emoji_count = await Emoji.count({ guild_id: guild_id });
|
||||
const { maxEmojis } = Config.get().limits.guild;
|
||||
|
||||
if (emoji_count >= maxEmojis) throw DiscordApiErrors.MAXIMUM_NUMBER_OF_EMOJIS_REACHED.withParams(maxEmojis);
|
||||
|
||||
const id = Snowflake.generate();
|
||||
|
||||
if (body.require_colons == null) body.require_colons = true;
|
||||
|
||||
const user = await User.findOneOrFail({ id: req.user_id });
|
||||
|
||||
body.image = (await handleFile(`/emojis/${id}`, body.image)) as string;
|
||||
|
||||
const emoji = await new Emoji({
|
||||
|
@ -67,8 +67,7 @@
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@fosscord/api": ["src/index"],
|
||||
"@fosscord/api/*": ["src/*"]
|
||||
"@fosscord/api": ["src/index"]
|
||||
},
|
||||
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
|
||||
"experimentalDecorators": true
|
||||
|
@ -32,13 +32,8 @@ export class ReadState extends BaseClass {
|
||||
user: User;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@RelationId((read_state: ReadState) => read_state.last_message)
|
||||
last_message_id: string;
|
||||
|
||||
@JoinColumn({ name: "last_message_id" })
|
||||
@ManyToOne(() => Message, { nullable: true })
|
||||
last_message?: Message;
|
||||
|
||||
@Column({ nullable: true })
|
||||
last_pin_timestamp?: Date;
|
||||
|
||||
|
@ -18,6 +18,7 @@ export * from "./Relationship";
|
||||
export * from "./Role";
|
||||
export * from "./Session";
|
||||
export * from "./Sticker";
|
||||
export * from "./StickerPack";
|
||||
export * from "./Team";
|
||||
export * from "./TeamMember";
|
||||
export * from "./Template";
|
||||
|
@ -4,7 +4,9 @@ import fetch from "node-fetch";
|
||||
import { Config } from "./Config";
|
||||
import multer from "multer";
|
||||
|
||||
export async function uploadFile(path: string, file: Express.Multer.File) {
|
||||
export async function uploadFile(path: string, file?: Express.Multer.File) {
|
||||
if (!file?.buffer) throw new HTTPError("Missing file in body");
|
||||
|
||||
const form = new FormData();
|
||||
form.append("file", file.buffer, {
|
||||
contentType: file.mimetype,
|
||||
|
Loading…
x
Reference in New Issue
Block a user