1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 13:14:06 +01:00

Create welcome_screen.ts

This commit is contained in:
Intevel ツ 2021-05-08 14:42:23 +02:00
parent 1e304fb1c9
commit 1ee6d29c64

View File

@ -0,0 +1,21 @@
import { Request, Response, Router } from "express";
import { GuildModel, getPermission, toObject, Snowflake } from "@fosscord/server-util";
import { HTTPError } from "lambert-server";
import { emitEvent } from "../../../util/Event";
import { check } from "../../../util/instanceOf";
import { GuildAddChannelToWelcomeScreenSchema } from "../../../schema/Guild";
import { getPublicUser } from "../../../util/User";
const router: Router = Router();
router.get("/", async (req: Request, res: Response) => {
const guild_id = req.params.id;
const guild = await GuildModel.findOne({ id: guild_id });
if (!guild) throw new HTTPError("Guild not found", 404);
res.json(toObject(guild.welcome_screen));
});
export default router;