Skip to content

Commit

Permalink
Fixed event server code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nupur Khare committed Nov 20, 2023
1 parent 3b76a2f commit 1561a47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kairon/events/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def index():
def add_event(
request: EventRequest,
is_scheduled: bool = Query(description="Whether the event is to be run once or scheduled"),
event_type: EventClass = Path(default=None, description="Event type", example=[e.value for e in EventClass])
event_type: EventClass = Path(description="Event type", example=[e.value for e in EventClass])
):
request.validate_request(is_scheduled, event_type)
response, message = EventUtility.add_job(event_type, request.dict(), is_scheduled)
Expand All @@ -132,13 +132,13 @@ def add_event(
def update_scheduled_event(
request: EventRequest,
is_scheduled: bool = Query(description="Whether the event is to be run once or scheduled"),
event_type: EventClass = Path(default=None, description="Event type", example=[e.value for e in EventClass])
event_type: EventClass = Path(description="Event type", example=[e.value for e in EventClass])
):
request.validate_request(is_scheduled, event_type)
response, message = EventUtility.update_job(event_type, request.dict(), is_scheduled)
return {"data": response, "message": message}


@app.delete("/api/events/{event_id}", response_model=Response)
def delete_scheduled_event(event_id: Text = Path(default=None, description="Event id")):
def delete_scheduled_event(event_id: Text = Path(description="Event id")):
return {"data": KScheduler().delete_job(event_id), "message": "Scheduled event deleted!"}

0 comments on commit 1561a47

Please sign in to comment.