1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-23 19:02:37 +01:00

🚧 shorten relative paths with @shortcut

This commit is contained in:
Flam3rboy 2021-03-22 21:52:56 +01:00
parent e902b805c1
commit b346ff857d
6 changed files with 31 additions and 21 deletions

View File

@ -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 { emitEvent } from "../../../../../util/Event";
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";

View File

@ -1,9 +1,9 @@
import { Router } from "express";
import { ChannelModel, getPermission, MessageDeleteBulkEvent, MessageModel } from "fosscord-server-util";
import { HTTPError } from "lambert-server";
import Config from "../../../../../../util/Config";
import { emitEvent } from "../../../../../../util/Event";
import { check } from "../../../../../../util/instanceOf";
import Config from "@util/Config";
import { emitEvent } from "@util/Event";
import { check } from "@util/instanceOf";
const router: Router = Router();

View File

@ -1,11 +1,11 @@
import { Router } from "express";
import { ChannelModel, ChannelType, getPermission, Message, MessageCreateEvent, MessageModel, Snowflake } from "fosscord-server-util";
import { HTTPError } from "lambert-server";
import { MessageCreateSchema } from "../../../../../../schema/Message";
import { check, instanceOf, Length } from "../../../../../../util/instanceOf";
import { PublicUserProjection } from "../../../../../../util/User";
import { MessageCreateSchema } from "@schema/Message";
import { check, instanceOf, Length } from "@util/instanceOf";
import { PublicUserProjection } from "@util/User";
import multer from "multer";
import { emitEvent } from "../../../../../../util/Event";
import { emitEvent } from "@util/Event";
const router: Router = Router();
export default router;
@ -120,7 +120,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => {
timestamp: new Date(),
};
await new MessageModel().save();
await new MessageModel(message).save();
await emitEvent({ event: "MESSAGE_CREATE", channel_id, data: {} } as MessageCreateEvent);
});

View File

@ -1,12 +1,12 @@
import { Request, Response, Router } from "express";
import { BanModel, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel } from "fosscord-server-util";
import { HTTPError } from "lambert-server";
import { getIpAdress } from "../../../../../middlewares/GlobalRateLimit";
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";
import { getIpAdress } from "@middlewares/GlobalRateLimit";
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";
const router: Router = Router();

View File

@ -1,4 +1,4 @@
import { Config } from "fosscord-server-util";
import { Config, Snowflake } from "fosscord-server-util";
import crypto from "crypto";
import fs from "fs";
@ -22,6 +22,9 @@ export interface RateLimit {
}
export interface DefaultOptions {
general: {
instance_id: bigint;
};
permissions: {
user: {
createGuilds: boolean;
@ -102,6 +105,9 @@ export interface DefaultOptions {
}
export const DefaultOptions: DefaultOptions = {
general: {
instance_id: Snowflake.generate(),
},
permissions: {
user: {
createGuilds: true,

View File

@ -43,8 +43,12 @@
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"baseUrl": "./src" /* Base directory to resolve non-absolute module names. */,
"paths": {
"@util/*": ["util/*"],
"@middlewares/*": ["middlewares/*"],
"@schema/*": ["schema/*"]
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
"types": ["node"] /* Type declaration files to be included in compilation. */,