gsd 4 months ago
parent
commit
218b945ba6
  1. 5
      dbService.py
  2. 5
      service.py
  3. 1
      webExtensions/messageList.py

5
dbService.py

@ -12,7 +12,7 @@ class MultiDeviceDbSupport:
#return {"$or": [{"device_uuid": value}]}
def deviceHash2Match(self, devices_hashes = []):
print(devices_hashes)
#print(devices_hashes)
if devices_hashes == None:
devices_hashes = [self.core.defaultDeviceUUIDHash]
elif (type(devices_hashes) == list):
@ -23,7 +23,7 @@ class MultiDeviceDbSupport:
if devices_hashes.__len__() == 0:
devices_hashes = [self.core.defaultDeviceUUIDHash]
print(devices_hashes)
#print(devices_hashes)
orPart = []
for hash in devices_hashes:
uuid = self.core.devicesUuidHashToUuid.get(hash, "")
@ -34,6 +34,7 @@ class MultiDeviceDbSupport:
return orPart#-->{"$or": orPart}
class MessageDbService(MultiDeviceDbSupport):
MESSAGE_PORTNUM = 1
def __init__(self, dbStore, core):
super().__init__(dbStore, core)

5
service.py

@ -216,7 +216,10 @@ class MongoDriver(MeshArgsParse):
del v["user"]
v["device_uuid"] = from_radio["device_uuid"]
await self.dbStore[k].insert_one(v)
try:
await self.dbStore[k].insert_one(v)
except:
logger.error("Cannot save packet to db", v)
def tryParseProtobuf(self, v):
try:

1
webExtensions/messageList.py

@ -8,7 +8,6 @@ from extra.MessageDTO import MessageDTO
from typing import List, Annotated
class WebExtension:
MESSAGE_PORTNUM = 1
app: FastAPI
dbStore: AsyncDatabase
def __init__(self, core):

Loading…
Cancel
Save