feat: auto-capitalize the first letter of transaction descriptions

Transactions/recurring templates entered with mixed casing ("траты на
продукты") are now capitalized on create/update via a Pydantic validator,
so the fix applies to every client, not just the web UI. Adds a one-off
backfill script for existing rows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ZProger
2026-08-24 23:10:22 +03:00
parent 2b2e01a8e2
commit 6cc532378b
6 changed files with 106 additions and 5 deletions

12
backend/app/core/text.py Normal file
View File

@@ -0,0 +1,12 @@
"""Shared text-formatting helpers."""
def capitalize_first_letter(value: str) -> str:
"""Uppercase the first character, leaving the rest of the string untouched.
Unlike str.capitalize()/str.title(), this never lowercases the rest of the
string — "iPhone 15" stays "iPhone 15", not "Iphone 15".
"""
if not value:
return value
return value[0].upper() + value[1:]