File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class WebhookLog(SQLModel, table=True):
3737 status_code : Optional [int ]
3838 timestamp : datetime .datetime = Field (default_factory = datetime .datetime .utcnow , nullable = False )
3939
40- webhook_endpoint_id : int | None = Field (default = None , foreign_key = 'webhookendpoint.id' )
40+ webhook_endpoint_id : int | None = Field (default = None , foreign_key = 'webhookendpoint.id' , index = True )
4141
4242 def __repr__ (self ):
4343 return f'WebhookLog(id={ self .id } , payload={ self .request_body } , created_at={ self .timestamp } )'
Original file line number Diff line number Diff line change @@ -181,7 +181,11 @@ async def get_logs(
181181
182182 # Get the Logs and related endpoint
183183 logs = db .exec (
184- select (WebhookLog ).where (WebhookLog .webhook_endpoint_id == endpoint .id ).offset (offset ).limit (100 )
184+ select (WebhookLog )
185+ .where (WebhookLog .webhook_endpoint_id == endpoint .id )
186+ .order_by (WebhookLog .timestamp .desc ())
187+ .offset (offset )
188+ .limit (100 )
185189 ).all ()
186190 list_of_webhooks = [
187191 {
You can’t perform that action at this time.
0 commit comments