rohanshaw commited on
Commit
a141e58
·
verified ·
1 Parent(s): da6396e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -298,23 +298,23 @@ async def admin_push(title: str = Body(...), body: str = Body(...)):
298
  return {"message": "Notifications sent"}
299
 
300
  @app.post("/api/app/parked")
301
- async def user_parked(requestBody: InAppEventNotification = Body(...)):
302
  send_push(requestBody.token, "WhereIParked", "You parked your car. Timer started!", "app")
303
  return {"message": "Notification sent"}
304
 
305
 
306
  @app.post("/api/app/clear-location")
307
- async def user_cleared(requestBody: InAppEventNotification = Body(...)):
308
  send_push(requestBody.token, "WhereIParked", "Parking location cleared. Safe drive!", "app")
309
  return {"message": "Notification sent"}
310
 
311
  @app.post("/api/app/park-duration")
312
- async def park_duration(requestBody: InAppEventNotification = Body(...), duration = str):
313
  send_push(requestBody.token, "Reminder", "You’ve been parked for over " + duration + " minutes!", "app")
314
  return {"message": "Notification sent"}
315
 
316
  @app.post("/admin/app/push")
317
- async def admin_push(title: str = Body(...), body: str = Body(...)):
318
  tokens = await db.fcmtokens.find().to_list(length=None)
319
  for token_entry in tokens:
320
  send_push(token_entry["token"], title, body, "app")
 
298
  return {"message": "Notifications sent"}
299
 
300
  @app.post("/api/app/parked")
301
+ async def app_user_parked(requestBody: InAppEventNotification = Body(...)):
302
  send_push(requestBody.token, "WhereIParked", "You parked your car. Timer started!", "app")
303
  return {"message": "Notification sent"}
304
 
305
 
306
  @app.post("/api/app/clear-location")
307
+ async def app_user_cleared(requestBody: InAppEventNotification = Body(...)):
308
  send_push(requestBody.token, "WhereIParked", "Parking location cleared. Safe drive!", "app")
309
  return {"message": "Notification sent"}
310
 
311
  @app.post("/api/app/park-duration")
312
+ async def app_park_duration(requestBody: InAppEventNotification = Body(...), duration = str):
313
  send_push(requestBody.token, "Reminder", "You’ve been parked for over " + duration + " minutes!", "app")
314
  return {"message": "Notification sent"}
315
 
316
  @app.post("/admin/app/push")
317
+ async def app_admin_push(title: str = Body(...), body: str = Body(...)):
318
  tokens = await db.fcmtokens.find().to_list(length=None)
319
  for token_entry in tokens:
320
  send_push(token_entry["token"], title, body, "app")