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:
parent
1e304fb1c9
commit
1ee6d29c64
21
src/routes/guilds/#guild_id/welcome_screen.ts
Normal file
21
src/routes/guilds/#guild_id/welcome_screen.ts
Normal 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;
|
Loading…
Reference in New Issue
Block a user