Skip to content

feat: Constrain transactions to one category and add tags #295

Description

@nfebe

Constrain a transaction to a single category so spend math has one unambiguous bucket, and add tags for the cross-cutting labels a second category used to stand in for. Today Transaction::categories() is a many-to-many relation (app/Models/Transaction.php:182) and there is no tag concept, so any per-category total has to either pick one of several or double count. Category becomes one-per-transaction (the spend bucket); tags become a separate user-scoped label that never feeds category, income, or expense totals. Web and mobile are blocked on this shape.

Constraint: this is the source of truth; the web and mobile follow-ups depend on the model and endpoints defined here.

Checklist

  • Move a transaction to exactly one category (single association), keeping category type (income/expense) intact.
  • Add a tag model and endpoints: user-scoped, many-to-many on transactions, independent of categories.
  • /stats builds the category breakdown from the single category; tags never contribute to any total.
  • Migrate existing multi-category transactions: keep one category, move the rest to tags.
  • Transaction serialization and sync expose the one category and the tag list.

Acceptance criteria

  • A transaction has at most one category and any number of tags.
  • /stats category totals sum to total expense (and income) with no double counting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions