no need to check for existing of route param

This commit is contained in:
liamcottle
2024-05-05 21:53:13 +12:00
parent ab71517f4a
commit e34a843077

16
web.py
View File

@@ -169,17 +169,11 @@ class ReticulumWebChat:
async def index(request):
# get path params
destination_hash = request.match_info.get("destination_hash", None)
destination_hash = request.match_info.get("destination_hash", "")
# get source hash from local lxmf destination
source_hash = self.local_lxmf_destination.hash.hex()
# destination_hash is required
if destination_hash is None:
return web.json_response({
"message": "destination_hash is required",
}, status=422)
# get lxmf messages from db where "source to destination" or "destination to source" and ordered by oldest to newest
db_lxmf_messages = (database.LxmfMessage.select()
.where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash))
@@ -215,17 +209,11 @@ class ReticulumWebChat:
async def index(request):
# get path params
destination_hash = request.match_info.get("destination_hash", None)
destination_hash = request.match_info.get("destination_hash", "")
# get source hash from local lxmf destination
source_hash = self.local_lxmf_destination.hash.hex()
# destination_hash is required
if destination_hash is None:
return web.json_response({
"message": "destination_hash is required",
}, status=422)
# delete lxmf messages from db where "source to destination" or "destination to source"
(database.LxmfMessage.delete()
.where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash))