added rename endpoint for groups

This commit is contained in:
2024-11-18 12:32:11 +03:00
parent 7d98ba89c5
commit 947dc720a5
6 changed files with 23 additions and 1 deletions

View File

@@ -37,6 +37,10 @@ class GroupService {
async getUsersInGroup(groupId) {
return (await db.query("SELECT id FROM users WHERE $1 = ANY(groups)", [groupId])).rows.map((group) => group.id)
}
async rename(groupId, newName) {
await db.query("UPDATE groups SET name = $1 WHERE id = $2", [newName, groupId]).catch((e) => errorHandler(e, "groups"));;
}
};
export default new GroupService();