1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 12:42:44 +01:00

Return none for dev portal + todo for categories

This commit is contained in:
Featyre 2022-02-02 02:09:57 +08:00
parent d4690aa7b6
commit 9f5c451cbc
3 changed files with 11 additions and 1 deletions

View File

@ -8,7 +8,13 @@ const router: Router = Router();
router.get("/", route({}), async (req: Request, res: Response) => {
const members = await Member.find({ relations: ["guild"], where: { id: req.user_id } });
res.json(members.map((x) => x.guild));
let guild = members.map((x) => x.guild);
if ("with_counts" in req.query && req.query.with_counts == "true") {
guild = []; // TODO: Load guilds with user role permissions number
}
res.json(guild);
});
// user send to leave a certain guild

View File

@ -13,6 +13,7 @@ import { BaseClassWithoutId } from "./BaseClass";
// },
// "is_primary": false/true
// }]
// Also populate discord default categories
@Entity("categories")
export class Categories extends BaseClassWithoutId { // Not using snowflake

View File

@ -270,6 +270,9 @@ export class Guild extends BaseClass {
@Column({ nullable: true })
nsfw?: boolean;
// only for developer portal
permissions?: number;
static async createGuild(body: {
name?: string;
icon?: string | null;