Skip to content

Commit

Permalink
feature: fix for issue with getting events by resource id
Browse files Browse the repository at this point in the history
  • Loading branch information
akeemphilbert committed Sep 10, 2024
1 parent eb50348 commit 2999ae9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rest/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ func (e *GORMEventStore) ResourceDeleteHandler(ctx context.Context, logger Log,

// GetByResourceID gets events by resource id
func (e *GORMEventStore) GetByResourceID(ctxt context.Context, logger Log, resourceID string) (events []*Event, err error) {
events = make([]*Event, 0)
result := e.gormDB.Model(&Event{}).Where("resource_id = ?", resourceID).Find(events)
result := e.gormDB.Model(&Event{}).Where("resource_id = ?", resourceID).Find(&events)
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
logger.Errorf("error getting events for resource %s: %v", resourceID, result.Error)
err = result.Error
Expand Down

0 comments on commit 2999ae9

Please sign in to comment.