mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
Allow nicknames through MemberChangeSchema
This commit is contained in:
parent
4fbebe17d3
commit
6a583fb88c
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@ const router = Router();
|
||||
|
||||
export interface MemberChangeSchema {
|
||||
roles?: string[];
|
||||
nick?: string;
|
||||
}
|
||||
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
@ -34,6 +35,8 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re
|
||||
member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist
|
||||
}
|
||||
|
||||
if (body.nick) member.nick = body.nick;
|
||||
|
||||
await member.save();
|
||||
|
||||
member.roles = member.roles.filter((x) => x.id !== everyone.id);
|
||||
|
Loading…
Reference in New Issue
Block a user