Skip to content

Commit

Permalink
notification logic added
Browse files Browse the repository at this point in the history
  • Loading branch information
sametd committed Mar 12, 2024
1 parent 23c4e62 commit e00feb5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions aviso-server/rest/aviso_rest/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def _skip_request(self, notification: Dict, skips: Dict) -> bool:
if s in notification and notification[s] in skips[s]:
return True
return False

def timed_notify(self, notification, config):
"""
This method allows to submit a notification to the store and to time it
"""
return self.timer(self.notification_manager.notify, args=(notification, config))

def run_server(self):
logger.info(
Expand Down Expand Up @@ -148,11 +154,12 @@ async def api_notify(request: Request):
if frontend._skip_request(notification, frontend.config.skips):
logger.info("Notification skipped")
return {"message": "Notification skipped"}
# Implement the notification logic here.
response = await frontend.timed_notify(notification, config.aviso)
logger.info("Notification successfully submitted")
return JSONResponse(content=response)
except InvalidInputError as e:
raise HTTPException(status_code=400, detail=str(e))
logger.info("Notification successfully submitted")
return {"message": "Notification successfully submitted"}



def main():
Expand Down

0 comments on commit e00feb5

Please sign in to comment.