rename token to card (eventlog)
not renaming inventory items, as they need migration refactor eventlog format, harmonized with inventory-app
This commit is contained in:
@@ -150,7 +150,7 @@ async def view_longpoll(request):
|
|||||||
ev = event["fullDocument"]
|
ev = event["fullDocument"]
|
||||||
if ev["approved"] != "true":
|
if ev["approved"] != "true":
|
||||||
continue
|
continue
|
||||||
if ev["type"] == "token":
|
if ev["type"] == "card":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
response.send("data: %s\n\n" % ev["door"])
|
response.send("data: %s\n\n" % ev["door"])
|
||||||
@@ -203,18 +203,17 @@ async def swipe(request):
|
|||||||
|
|
||||||
event_swipe = {
|
event_swipe = {
|
||||||
"component": "doorboy",
|
"component": "doorboy",
|
||||||
"method": "token",
|
"method": "card",
|
||||||
"timestamp": timestamp,
|
"timestamp": timestamp,
|
||||||
"door": data["door"],
|
"door": data["door"],
|
||||||
"event": "card-swiped",
|
|
||||||
"approved": data["approved"],
|
"approved": data["approved"],
|
||||||
"uid_hash": data["uid_hash"],
|
|
||||||
"user": {
|
"user": {
|
||||||
"id": token.get("inventory", {}).get("owner", {}).get("username", ""),
|
"id": token.get("inventory", {}).get("owner", {}).get("username", ""),
|
||||||
"name": token.get("inventory", {})
|
"name": token.get("inventory", {})
|
||||||
.get("owner", {})
|
.get("owner", {})
|
||||||
.get("display_name", "Unclaimed Token"),
|
.get("display_name", "Unclaimed Token"),
|
||||||
},
|
},
|
||||||
|
"uid_hash": data["uid_hash"],
|
||||||
}
|
}
|
||||||
await app.ctx.db.eventlog.insert_one(event_swipe)
|
await app.ctx.db.eventlog.insert_one(event_swipe)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user