Skip to content

fix(catalog): preserve add-on identity and report import reactivations #246

Description

@khaira777

Summary

Editing an add-on group deletes all existing child rows and recreates them with new UUIDs. Historical normalized order snapshots retain name/price but lose their catalog addon_id link. CSV imports also silently reactivate soft-deleted records and report reactivated rows as created.

Current behavior

  • main/routes/addon-groups.ts:197-226 deletes and recreates every child during a group update.
  • main/routes/menu-csv.ts:393-434 reactivates groups/add-ons without separate reactivation counters.
  • main/db.ts:2420-2432 uses ON DELETE SET NULL for historical add-on references.

Expected behavior

Existing add-on IDs should remain stable across edits, removed children should be handled deliberately, and import results should distinguish created, reactivated, updated, and skipped records.

Acceptance criteria

  • Upsert children by supplied existing ID.
  • Preserve created_at and historical references.
  • Soft-deactivate removed children instead of deleting historical identities.
  • Make reactivation an explicit import policy and expose separate counters.
  • Add tests covering historical order snapshots, analytics joins, and soft-deleted imports.

Relevant files

main/routes/addon-groups.ts, main/routes/menu-csv.ts, main/db.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend (Express/SQLite)bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions