diff --git a/internal/licenses/manager.go b/internal/licenses/manager.go index d0842c4..39aec32 100644 --- a/internal/licenses/manager.go +++ b/internal/licenses/manager.go @@ -319,8 +319,11 @@ func (m *manager) ReleaseLicense(ctx context.Context, fingerprint string) (*Lice } if m.config.EnabledAudit { - if err := m.store.InsertAuditLog(ctx, db.EventTypeLicenseReleased, db.EntityTypeLicense, claimedLicense.ID); err != nil { - slog.Warn("failed to insert audit log", "licenseID", claimedLicense.ID, "error", err) + if err := m.store.BulkInsertAuditLogs(ctx, []db.BulkInsertAuditLogParams{ + {EventTypeID: db.EventTypeLicenseReleased, EntityTypeID: db.EntityTypeLicense, EntityID: claimedLicense.ID}, + {EventTypeID: db.EventTypeNodeDeactivated, EntityTypeID: db.EntityTypeNode, EntityID: node.Fingerprint}, + }); err != nil { + slog.Warn("failed to insert audit logs", "error", err) } }