s/eventlog/doorlog/

This commit is contained in:
2026-06-11 21:27:04 +03:00
parent c7e053b500
commit 973c6ac390
2 changed files with 4 additions and 6 deletions

View File

@@ -146,7 +146,7 @@ async def view_longpoll(request):
} }
] ]
try: try:
async with request.app.ctx.db.eventlog.watch(pipeline) as stream: async with request.app.ctx.db.doorlog.watch(pipeline) as stream:
await response.send("data: watch-stream-opened\n\n") await response.send("data: watch-stream-opened\n\n")
async for event in stream: async for event in stream:
ev = event["fullDocument"] ev = event["fullDocument"]
@@ -205,7 +205,6 @@ async def swipe(request):
) )
event_swipe = { event_swipe = {
"component": "doorboy",
"method": "card", "method": "card",
"timestamp": timestamp, "timestamp": timestamp,
"door": data["door"], "door": data["door"],
@@ -218,7 +217,7 @@ async def swipe(request):
}, },
"uid_hash": data["uid_hash"], "uid_hash": data["uid_hash"],
} }
await request.app.ctx.db.eventlog.insert_one(event_swipe) await request.app.ctx.db.doorlog.insert_one(event_swipe)
return text("ok") return text("ok")

View File

@@ -48,7 +48,7 @@ async def slack_log_fwd(app, loop):
] ]
while True: while True:
try: try:
async with app.ctx.db.eventlog.watch(pipeline) as stream: async with app.ctx.db.doorlog.watch(pipeline) as stream:
async for event in stream: async for event in stream:
ev = event["fullDocument"] ev = event["fullDocument"]
@@ -120,9 +120,8 @@ async def slack_open(request):
doors = ["backdoor", "frontdoor", "grounddoor"] doors = ["backdoor", "frontdoor", "grounddoor"]
for d in doors: for d in doors:
await request.app.ctx.db.eventlog.insert_one( await request.app.ctx.db.doorlog.insert_one(
{ {
"component": "doorboy",
"method": "slack", "method": "slack",
"timestamp": datetime.now(timezone.utc), "timestamp": datetime.now(timezone.utc),
"door": d, "door": d,