feat: idle cash alert and category hierarchy (subcategories)

Two of the four ideas picked from the Maybe/Sure feature audit:

- Idle cash: a 5th proactive alert flags a depository account (checking/
  savings/cash) sitting at or above a configurable balance with no
  transaction touching it for a configurable number of days.
- Category hierarchy: categories can now have one level of subcategories
  (Groceries -> Alcohol). Dashboard/report aggregations roll a
  subcategory's spending into its parent's slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ZProger
2026-08-25 02:27:46 +03:00
parent 79e4ebb06b
commit 09a0e383e0
23 changed files with 628 additions and 81 deletions

View File

@@ -9,6 +9,9 @@ class CategoryBase(BaseModel):
icon: str | None = None
color: str = Field(pattern=r"^#[0-9a-fA-F]{6}$")
sort_order: int = 0
# Subcategory parent, one level deep only — routes/categories.py rejects
# a parent that itself already has a parent.
parent_id: int | None = None
class CategoryCreate(CategoryBase):
@@ -20,6 +23,10 @@ class CategoryUpdate(BaseModel):
icon: str | None = None
color: str | None = Field(default=None, pattern=r"^#[0-9a-fA-F]{6}$")
sort_order: int | None = None
# The route uses exclude_unset=True, so sending parent_id explicitly as
# null (as opposed to omitting the field) is what turns a subcategory
# back into a top-level category.
parent_id: int | None = None
class CategoryRead(CategoryBase):