Skip to content

Commit

Permalink
fix events
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fischer committed Dec 19, 2024
1 parent 7dbe3e1 commit bd6b5b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion management/server/networks/resources/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func (m *managerImpl) DeleteResourceInTransaction(ctx context.Context, transacti
}

eventsToStore = append(eventsToStore, func() {
m.accountManager.StoreEvent(ctx, accountID, resourceID, accountID, activity.NetworkResourceDeleted, resource.EventMeta(network))
m.accountManager.StoreEvent(ctx, userID, resourceID, accountID, activity.NetworkResourceDeleted, resource.EventMeta(network))
})

return eventsToStore, nil
Expand Down
10 changes: 5 additions & 5 deletions management/server/networks/routers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Manager interface {
GetRouter(ctx context.Context, accountID, userID, networkID, routerID string) (*types.NetworkRouter, error)
UpdateRouter(ctx context.Context, userID string, router *types.NetworkRouter) (*types.NetworkRouter, error)
DeleteRouter(ctx context.Context, accountID, userID, networkID, routerID string) error
DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, networkID, routerID string) (func(), error)
DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, userID, networkID, routerID string) (func(), error)
}

type managerImpl struct {
Expand Down Expand Up @@ -206,7 +206,7 @@ func (m *managerImpl) DeleteRouter(ctx context.Context, accountID, userID, netwo

var event func()
err = m.store.ExecuteInTransaction(ctx, func(transaction store.Store) error {
event, err = m.DeleteRouterInTransaction(ctx, transaction, accountID, networkID, routerID)
event, err = m.DeleteRouterInTransaction(ctx, transaction, accountID, userID, networkID, routerID)
if err != nil {
return fmt.Errorf("failed to delete network router: %w", err)
}
Expand All @@ -229,7 +229,7 @@ func (m *managerImpl) DeleteRouter(ctx context.Context, accountID, userID, netwo
return nil
}

func (m *managerImpl) DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, networkID, routerID string) (func(), error) {
func (m *managerImpl) DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, userID, networkID, routerID string) (func(), error) {
network, err := transaction.GetNetworkByID(ctx, store.LockingStrengthShare, accountID, networkID)
if err != nil {
return nil, fmt.Errorf("failed to get network: %w", err)
Expand All @@ -250,7 +250,7 @@ func (m *managerImpl) DeleteRouterInTransaction(ctx context.Context, transaction
}

event := func() {
m.accountManager.StoreEvent(ctx, "", routerID, accountID, activity.NetworkRouterDeleted, router.EventMeta(network))
m.accountManager.StoreEvent(ctx, userID, routerID, accountID, activity.NetworkRouterDeleted, router.EventMeta(network))
}

return event, nil
Expand Down Expand Up @@ -284,6 +284,6 @@ func (m *mockManager) DeleteRouter(ctx context.Context, accountID, userID, netwo
return nil
}

func (m *mockManager) DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, networkID, routerID string) (func(), error) {
func (m *mockManager) DeleteRouterInTransaction(ctx context.Context, transaction store.Store, accountID, userID, networkID, routerID string) (func(), error) {
return func() {}, nil
}

0 comments on commit bd6b5b6

Please sign in to comment.