update rooms.py
This commit is contained in:
+37
-2
@@ -23,7 +23,42 @@ def create_room(
|
||||
)
|
||||
)
|
||||
|
||||
return room_id
|
||||
query2 = """
|
||||
SELECT id
|
||||
FROM rooms
|
||||
WHERE invite_code = ?
|
||||
"""
|
||||
room = fetch_one(
|
||||
query2,
|
||||
(
|
||||
invite_code,
|
||||
)
|
||||
)
|
||||
|
||||
if room is None:
|
||||
return None
|
||||
|
||||
room_id = room["id"]
|
||||
role = DEFAULT_ROLE
|
||||
query3 = """
|
||||
INSERT INTO "main"."room_members"
|
||||
("room_id", "user_id", "role")
|
||||
VALUES (?, ?, ?);
|
||||
"""
|
||||
|
||||
member_id = execute(
|
||||
query3,
|
||||
(
|
||||
room_id,
|
||||
creator_id,
|
||||
role
|
||||
)
|
||||
)
|
||||
|
||||
return {
|
||||
"room_id": room_id,
|
||||
"member_id": member_id
|
||||
}
|
||||
|
||||
def search_room(
|
||||
invite_code
|
||||
@@ -43,7 +78,7 @@ def search_room(
|
||||
if room is None:
|
||||
return None
|
||||
|
||||
return room_name["name"]
|
||||
return room["name"]
|
||||
|
||||
|
||||
def accept_room(
|
||||
|
||||
Reference in New Issue
Block a user