Skip to content

Group inventory: add atomic trainer-to-group transfer route #39

Description

@prodmodfour

Goal

Move item quantities from a trainer sheet back into the shared group inventory atomically.

Scope

  • Add a use case and API route for trainer-to-group transfers.
  • Accept trainerSlug, trainerRevision, groupSlug, groupRevision, section, a trainer row identifier or row index, and quantity.
  • In one SQLite transaction:
    • read the trainer sheet and group inventory;
    • validate both revisions;
    • decrement/remove the trainer row;
    • merge the item into the group inventory section;
    • increment both document revisions;
    • return the authoritative trainer sheet update and group inventory.
  • Start with GM-only access in this ticket.

Acceptance criteria

  • Successful transfer updates both documents atomically.
  • If either revision is stale, neither document changes.
  • Invalid quantity, missing row, missing group inventory, and equipment partial-transfer cases are rejected clearly.
  • Tests cover stackable and equipment transfers.

Depends on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions