A continuation of HomeBox the inventory and organization system built for the Home User
Improve error handling and comments in WipeInventory method
copilot-swe-agent[bot]aa48c958d75b
diff --git a/.scaffold/go.sum b/.scaffold/go.sumindex 8d91d370..90805ece 100644--- a/.scaffold/go.sum+++ b/.scaffold/go.sum@@ -8,7 +8,7 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIgithub.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=-github.com/sysadminsmedia/homebox/backend v0.0.0-20251212183312-2d1d3d927bfd h1:QULUJSgHc4rSlTjb2qYT6FIgwDWFCqEpnYqc/ltsrkk=-github.com/sysadminsmedia/homebox/backend v0.0.0-20251212183312-2d1d3d927bfd/go.mod h1:jB+tPmHtPDM1VnAjah0gvcRfP/s7c+rtQwpA8cvZD/U=+github.com/sysadminsmedia/homebox/backend v0.0.0-20251226222718-473027c1aea3 h1:O7Sy/SfxuqxaeR4kUK/sRhHPeKrmraszRyK7ROJZ7Qw=+github.com/sysadminsmedia/homebox/backend v0.0.0-20251226222718-473027c1aea3/go.mod h1:9zHHw5TNttw5Kn4Wks+SxwXmJPz6PgGNbnB4BtF1Z4c=gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=diff --git a/backend/internal/data/repo/repo_items.go b/backend/internal/data/repo/repo_items.goindex d6e3cd0d..2ac67c61 100644--- a/backend/internal/data/repo/repo_items.go+++ b/backend/internal/data/repo/repo_items.go@@ -820,7 +820,9 @@ func (e *ItemsRepository) WipeInventory(ctx context.Context, gid uuid.UUID) (int}deleted := 0- // Delete each item using DeleteByGroup to ensure proper cleanup+ // Delete each item with its attachments+ // Note: We manually delete attachments and items instead of calling DeleteByGroup+ // to continue processing remaining items even if some deletions failfor _, itm := range items {// Delete all attachments firstfor _, att := range itm.Edges.Attachments {@@ -840,9 +842,11 @@ func (e *ItemsRepository) WipeInventory(ctx context.Context, gid uuid.UUID) (int).Exec(ctx)if err != nil {log.Err(err).Str("item_id", itm.ID.String()).Msg("failed to delete item during wipe inventory")+ // Skip to next item without incrementing countercontinue}+ // Only increment counter if deletion succeededdeleted++}