update endopoints

This commit is contained in:
ben
2026-08-17 15:15:37 +02:00
parent 80e46c09a3
commit 36a6c47081
2 changed files with 65 additions and 11 deletions
+37 -2
View File
@@ -133,7 +133,7 @@ def get_rooms(user_id):
)
return rooms
def delete_room(room_id):
room = execute(
"""
@@ -243,4 +243,39 @@ def leave_room(room_id, user_id):
room_id,
user_id
)
)
)
def change_room_name(room_id, new_name, user_id):
room = execute(
"""
SELECT id
FROM rooms
WHERE id = ?
""",
(room_id,)
)
if not room:
return {
"status": "error",
"reason": "room_not_found"
}
execute(
"""
UPDATE rooms
SET room_name = ?
WHERE id = ?
""",
(
new_name,
room_id
)
)
return {
"status": "updated",
"new_name": new_name,
"room_id": room_id,
"updated_by": user_id
}