Merge branch 'master' of https://github.com/fosscord/fosscord-api
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Channel, ChannelPinsUpdateEvent, Config, emitEvent, getPermission, Message, MessageUpdateEvent } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { DiscordApiErrors } from "../../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { check, Length } from "../../../util/instanceOf";
|
||||
import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { isTextChannel } from "./messages/index";
|
||||
import { DiscordApiErrors } from "../../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
// TODO: webhooks
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Guild } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { In } from "typeorm";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get("/", async (req: Request, res: Response) => {
|
||||
const { limit } = req.params;
|
||||
|
||||
// ! this only works using SQL querys
|
||||
// TODO: implement this with default typeorm query
|
||||
// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
|
||||
const guilds = await Guild.find({ where: `"features" LIKE 'COMMUNITY'`, take: Math.abs(Number(limit)) });
|
||||
res.send({ guilds: guilds });
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -50,7 +50,8 @@ router.patch("/", check(MemberChangeSchema), async (req: Request, res: Response)
|
||||
});
|
||||
|
||||
router.put("/", async (req: Request, res: Response) => {
|
||||
const { guild_id, member_id } = req.params;
|
||||
let { guild_id, member_id } = req.params;
|
||||
if (member_id === "@me") member_id = req.user_id;
|
||||
|
||||
throw new HTTPError("Maintenance: Currently you can't add a member", 403);
|
||||
// TODO: only for oauth2 applications
|
||||
|
||||
@@ -14,7 +14,7 @@ import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { RoleModifySchema, RolePositionUpdateSchema } from "../../../schema/Roles";
|
||||
import { DiscordApiErrors } from "../../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
import { In } from "typeorm";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "./../../util/instanceOf";
|
||||
import { GuildCreateSchema } from "../../schema/Guild";
|
||||
import { DiscordApiErrors } from "../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Template, Guild, Role, Snowflake, Config, User, Member } from "@fosscor
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildTemplateCreateSchema } from "../../../schema/Guild";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { DiscordApiErrors } from "../../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
router.get("/:code", async (req: Request, res: Response) => {
|
||||
const { code } = req.params;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//TODO: this is a template for a generic route
|
||||
|
||||
import { Router, Request, Response } from "express";
|
||||
const router = Router();
|
||||
|
||||
router.get("/", async (req: Request, res: Response) => {
|
||||
res.send({});
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { DiscordApiErrors } from "../../../util/Constants";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
import { check, Length } from "../../../util/instanceOf";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user