Skip to content

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

Description

@prodmodfour

Goal

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

Scope

  • Add a use case and API route for group-to-trainer transfers.
  • Accept groupSlug, groupRevision, trainerSlug, trainerRevision, section, itemId, and quantity.
  • In one SQLite transaction:
    • read the group inventory and trainer sheet;
    • validate both revisions;
    • decrement/remove the group row;
    • merge the item into the trainer inventory section;
    • increment both document revisions;
    • return the authoritative group inventory and trainer sheet update.
  • 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 trainer, and equipment partial-transfer cases are rejected clearly.
  • Tests prove rollback when the second write fails.

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