mirror of
https://github.com/Zproger/Aurum.git
synced 2026-11-07 00:07:22 +07:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user