Attribute token.enabled is timestamp, not boolean
This commit is contained in:
parent
bca9264ce9
commit
9bde906929
13
README.md
13
README.md
@ -1,3 +1,16 @@
|
||||
# Backgruond
|
||||
|
||||
This component serves allowed list of keyfob UID hashes from MongoDB and
|
||||
pushes open door commands to door controllers.
|
||||
|
||||
# Testing endpoints
|
||||
|
||||
```
|
||||
source .env
|
||||
curl -f http://doorboy.infra.k-space.ee:5000/allowed -H "KEY: $DOORBOY_SECRET" | md5sum
|
||||
```
|
||||
|
||||
|
||||
# Deploying
|
||||
|
||||
```
|
||||
|
2
main.py
2
main.py
@ -24,7 +24,7 @@ async def view_doorboy_uids(request):
|
||||
async for obj in db.member.find({"enabled": True}):
|
||||
allowed_names.append(obj["_id"])
|
||||
allowed_uids = []
|
||||
async for obj in db.inventory.find({"token.uid_hash": {"$exists":True}, "inventory.owner_id": {"$exists":True}, "token.enabled": True}, {"inventory.owner_id": True, "token.uid_hash": True }):
|
||||
async for obj in db.inventory.find({"token.uid_hash": {"$exists":True}, "inventory.owner_id": {"$exists":True}, "token.enabled": {"$exists":True}}, {"inventory.owner_id": True, "token.uid_hash": True }):
|
||||
if obj["inventory"].pop("owner_id") in allowed_names:
|
||||
del obj["_id"]
|
||||
del obj["inventory"]
|
||||
|
Loading…
Reference in New Issue
Block a user