Commit Graph

37 Commits

Author SHA1 Message Date
ZProger
848ff21665 feat: профили импорта CSV для Т-Банка, monobank и ПриватБанка, версия 1.1.8 2026-09-13 06:32:36 +03:00
ZProger
f9413aa6e1 security: устранить находки аудита, версия 1.1.7
Конфигурация и эксплуатационный слой:
- nginx: client_max_body_size 64m — восстановление из бэкапа не работало
  вовсе, дефолтный лимит в 1 МБ резал дампы (реальный экспорт ~3.4 МБ)
  с 413 ещё до backend;
- nginx: заголовки безопасности (nosniff, Referrer-Policy,
  Permissions-Policy) и полный Content-Security-Policy. Ради него
  inline-скрипт темы вынесен в public/theme-init.js;
- nginx: limit_req на /api/ — перебор пароля Basic Auth шёл со
  скоростью сети, ни блокировки, ни задержки не было;
- nginx: server_tokens off;
- порт web привязан к 127.0.0.1, адрес настраивается через
  AURUM_BIND_ADDRESS (раньше слушался на всех интерфейсах);
- backend работает от непривилегированного пользователя,
  no-new-privileges для backend и web;
- дефолты пароля Postgres сведены к одному значению в обоих сервисах,
  в .env.example описана ловушка с инициализацией тома.

Приложение:
- версия убрана из неавторизованного /api/health и отдаётся как
  app_version в GET /api/settings;
- /api/docs, /api/redoc и /api/openapi.json отключаются через
  AURUM_ENABLE_DOCS;
- текст исключения при неудачном восстановлении уходит в лог, а не
  клиенту;
- max_length для notes в схемах транзакций, активов и регулярных
  платежей (и в соответствующих полях UI);
- срок «запомнить меня» сокращён с 30 дней до 7;
- pytest обновлён до 9.0.3 (PYSEC-2026-1845), pytest-asyncio до 1.4.0;
- CI: permissions contents:read для GITHUB_TOKEN.
2026-09-10 21:12:31 +03:00
ZProger
225b46dc61 build(deps): обновить vite, @vitejs/plugin-react, react-router-dom, @types/node, @types/react-dom
Закрывает Dependabot PR #23, #26, #29, #30, #31 — все minor/patch,
билд и тесты зелёные.
2026-09-09 01:20:42 +03:00
ZProger
12a3068bee Merge branch 'db-26' 2026-09-09 01:19:49 +03:00
ZProger
31471a14ec Merge branch 'db-31' 2026-09-09 01:19:49 +03:00
dependabot[bot]
a27b35febf build(deps-dev): bump @types/react-dom in /frontend
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 19.2.4 to 19.2.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

---
updated-dependencies:
- dependency-name: "@types/react-dom"
  dependency-version: 19.2.7
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-08 22:06:48 +00:00
dependabot[bot]
7647eabdfa build(deps-dev): bump @types/node from 26.2.0 to 26.4.1 in /frontend
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 26.2.0 to 26.4.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 26.4.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-08 22:06:43 +00:00
dependabot[bot]
bc4f861a78 build(deps-dev): bump vite from 8.2.1 to 8.2.2 in /frontend
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.2.1 to 8.2.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.2.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.2.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-08 22:06:26 +00:00
ZProger
f5c6591310 test: юнит-тесты на форматирование и разбивки крипто-портфеля + версия 1.1.6
Vitest для чистой логики: lib/format.ts (заодно поймал баг в
trimTrailingZeros на "-0.000") и расчёт разбивки по риску/монете/сети
на вкладке Crypto — вынес их из компонентов в отдельные тестируемые
функции. Тесты подключены в CI. Версия приложения обновлена до 1.1.6.
2026-09-09 00:52:27 +03:00
ZProger
c0f446b3b3 fix: копеечные цены крипты не округлялись в $0 2026-09-04 02:37:09 +03:00
ZProger
bd97e316cc fix: сортировать активы в «Криптовалюте» по вложенной сумме
Монеты в таблице активов шли в алфавитном порядке (сортировка по
имени в SQL-запросе) — с импортированными портфелями это выглядело
хаотично. Теперь список отсортирован по cost basis (сколько денег
реально вложено в монету) от большего к меньшему; полностью
проданная позиция уходит в конец списка, а не в начало.
2026-09-04 02:26:37 +03:00
ZProger
cd125e9e45 fix: график крипты открывать за всё время, лучший/худший рост — по выбранному периоду
График во вкладке «Криптовалюта» теперь по умолчанию показывает всю
историю, а не 30 дней — короткое окно у портфеля, растущего годами,
часто попадало на локальную просадку и выглядело демотивирующе.

Плитки «Лучший рост» и «Худшее падение» раньше всегда считались за
24 часа. Теперь они следуют за диапазоном, выбранным у графика
(7д/30д/90д/всё время): для 7д/30д используются закэшированные данные
CoinGecko, для «всё время» — метрика за 1 год (дальше бесплатный
тариф CoinGecko историю не отдаёт), а для 90д — отдельный запрос по
каждой монете, который выполняется только когда пользователь реально
выбрал этот период.
2026-09-04 02:18:31 +03:00
ZProger
aefd6cc035 feat: портфели в разделе «Криптовалюта»
Криптовалюту теперь можно разделять на отдельные портфели (например,
долгосрочные инвестиции, накопления на недвижимость, спекулятивные
монеты) вместо одного общего списка — по тому же принципу, что уже
есть у счетов (Account): у портфеля есть имя, цветная метка и
архивация, каждая монета обязательно принадлежит одному портфелю,
один и тот же токен можно держать в нескольких портфелях сразу.
2026-09-04 01:39:18 +03:00
ZProger
c2f59c8773 fix: учитывать инвестсчета как наличные в расчёте капитала
Тип счёта investment не входил в CASH_ACCOUNT_TYPES, из-за чего деньги
на инвестсчёте не попадали ни в блок "Наличные", ни в класс "Инвестиции"
раздела Капитал — просто выпадали из расчёта net worth (issue #14).
2026-09-03 23:29:27 +03:00
ZProger
946b78d989 feat: показывать версию приложения в настройках, версия 1.1.0
Версии бэкенда и фронтенда были не синхронизированы и нигде не отображались
в интерфейсе — непонятно было, обновилось ли приложение после пересборки.
Теперь единая версия 1.1.0 приходит с бэкенда через /api/health и мелким
текстом выводится внизу страницы настроек.
2026-09-02 02:21:05 +03:00
ZProger
19f5cfa429 feat: import transactions from a CSV bank statement
Fourth of the four ideas picked from the Maybe/Sure feature audit, and the
last one queued up. A 3-step wizard (account -> column mapping -> preview)
at /transactions/import, parsed entirely client-side (new lib/csv.ts —
delimiter auto-detect, 5 date formats, thousands/decimal-separator-aware
amounts) and submitted through a new all-or-nothing POST /transactions/bulk
endpoint, mirroring backup restore's validate-everything-before-touching-
anything approach.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 02:44:30 +03:00
ZProger
94782ee073 feat: add free-form tags on transactions
Third of the four ideas picked from the Maybe/Sure feature audit. Tags are
orthogonal to categories (category = what kind of spend, tag = which
event/project) — many-to-many, created inline while typing in the
transaction form, filterable from the Transactions page.

Also adds tests/test_backup.py, the first test coverage the backup
export/import path has ever had, and fixes a MissingGreenlet bug it
surfaced in restore_backup's tag-wiring.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 02:38:04 +03:00
ZProger
09a0e383e0 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>
2026-08-25 02:27:46 +03:00
ZProger
79e4ebb06b fix: sort category lists alphabetically on the Categories page
Expense/income lists were rendered in server sort_order (chart palette
slot order), which looks arbitrary for browsing/managing categories.
Sorts by translated name instead, locale-aware — same approach
BudgetFormModal's category picker already uses. Display-only; sort_order
itself is untouched since the dashboard donut chart still relies on it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 23:56:54 +03:00
ZProger
2c6fcd628c feat: add 4 default income categories, localize category display names
Fresh installs (this app is published on GitHub) only got Salary,
Freelance, Investments, Gifts, Other Income by default — adds Business
Income, Rental Income, Benefits, and Item Sales, rounding out the 8-slot
categorical palette. Only affects new databases (seeding is a one-time
no-op once any category exists).

Also fixes CategoryList.tsx (added last commit) to run category names
through translateCategoryName() like every other category display in the
app, and registers the new defaults' translation keys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 23:51:33 +03:00
ZProger
9f5ea00227 feat: add category management page (create/edit/delete)
The backend already had full category CRUD but nothing in the UI exposed
it — categories could only be viewed inside charts. Adds a Categories nav
item and page with icon/color pickers, grouped by expense/income, backed
by new create/update/delete mutations. Also expands icons.tsx's ICON_MAP,
which was missing 14 icon keys already in use by real category data and
silently falling back to a wallet glyph everywhere they render.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 23:43:06 +03:00
ZProger
6cc532378b 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>
2026-08-24 23:10:22 +03:00
ZProger
2b2e01a8e2 feat: add search to Transactions tab, spanning all history
Lets the user find a past purchase by keyword instead of paging through
months manually — search hits description/merchant/notes and ignores the
month filter, with a "jump to month" action on each result to view it in
its normal monthly context.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 23:00:44 +03:00
ZProger
b9ff3ab404 fix: Transactions открывался на январе вместо текущего месяца
parseMonthParam передавал Number(null) дальше — а это 0, не NaN, поэтому
проверка "отсутствует/невалиден -> fallback" не срабатывала и месяц
зажимался в 1. Добавил явную проверку value === null и диапазон 1-12
вместо клампинга (тот же фикс для parseYearParam для единообразия).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 02:39:17 +03:00
ZProger
bbbd67bc72 fix: risk_level актива не сохранялся при создании и не отдавался в API
Asset(...) в create_asset игнорировал payload.risk_level, а _to_read()
не передавал risk_level в AssetRead — из-за дефолта в схеме API всегда
отвечал Medium вне зависимости от выбора в форме и данных в БД.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 02:14:09 +03:00
ZProger
d1458eb160 feat: view and edit a transaction's note from the list
Transactions can carry a `notes` field (set via the API — e.g. the
currency-conversion metadata on this user's imported historical data), but
there was no way to see it in the UI at all.

TransactionsTable now shows a note icon next to edit/delete, only when a
transaction actually has one, opening a dialog with the text. The edit
form's `notes` field was already wired end to end (state, payload) but had
no input in the JSX — added it, since a view-only note with no way to edit
or clear it would be a dead end.

Also fixed e2e/run.sh's readiness check, found while running the full
suite for this change: it polled `/` (nginx, answers almost immediately)
instead of `/api/health`, so the first test could start before the backend
finished migrating/seeding and fail trying to parse nginx's HTML error
page as JSON.
2026-08-16 23:50:10 +03:00
ZProger
7235d74f80 fix: move category spending chart above the ranking list on Reports
Picking a category at the top meant scrolling past the whole "top
categories" list before reaching its chart, then scrolling back up to
pick another one. Swapped the two so the chart renders immediately after
the category/range selector.
2026-08-16 23:37:51 +03:00
ZProger
1f5fab5010 refactor: merge Language and Theme settings into one two-column card
Language and Theme were two separate Cards stacked on top of each other —
both are pure client-side display preferences, so splitting them side by
side (language left, theme right) saves a card's worth of vertical space.
Collapses back to a single column on mobile.
2026-08-16 23:27:55 +03:00
ZProger
75dd43c8e3 feat: manual theme picker (light/dark/system) in Settings
Theme previously followed only the OS's prefers-color-scheme, which
switches automatically on this user's Mac at sunset/sunrise. Adds an
explicit override in Settings: Light/Dark/System, System being the
previous (default) auto-follow-the-OS behavior.

Persisted client-side in localStorage (lib/theme.ts, same pattern as
language) rather than server-side like currency — it's a pure display
preference, and synchronous localStorage reads are what make the
anti-FOUC inline script in index.html possible. index.css already had the
[data-theme] CSS variables laid in ahead of time; only the JS to actually
set the attribute, and the Settings UI, were missing.

Covered by 2 new Playwright specs (theme-switcher.spec.ts) run against the
isolated e2e stack: explicit choice overrides a dark OS and survives
reload; switching back to "system" doesn't leave a stale forced theme.
2026-08-16 23:12:20 +03:00
ZProger
8e46726b4d test: real backend pytest + E2E Playwright suites, both isolated from prod data
backend/tests/: 33 pytest tests against a real Postgres database
(aurum_test, created/migrated/dropped per run) exercised through the actual
HTTP API — not sqlite, not mocks, and the real `aurum` database is never
opened (app lifespan is skipped, get_session is overridden per test).
Covers transaction category-kind validation, year/month/date-range
filtering and pagination, dashboard summary arithmetic, budget status, cash
flow, and the /transactions/years picker.

e2e/: 6 Playwright specs driving a real browser against a fully separate
throwaway docker-compose stack (run.sh: separate project name, database,
port, and volume, torn down with `down -v` on exit) — regression coverage
for the Recent Transactions month bug, the Card grid-overflow bug, the
frozen-year bug, the Net Worth default range, and the Dashboard->
Transactions deep link, all fixed earlier this session.

Also synced the backend's APP_VERSION constant (stale at 0.15.2, embedded
in exported backups) with the frontend version.
2026-08-16 22:56:53 +03:00
ZProger
98c61d50d8 fix: Net Worth defaults to 5y, Dashboard->Transactions keeps month/year
Net Worth opened on a 30-day window by default, which frequently shows
a dip (short windows don't have enough recorded income relative to
spending) even though the long-term trend is a steady climb —
demotivating for no good reason. Defaults to 5y instead.

Dashboard's "All transactions" link always sent users to the current
month regardless of which month they had selected. It now carries
?year=&month= and TransactionsPage seeds its state from those params
(clamped/validated, falls back to the current month if absent).
2026-08-16 22:31:10 +03:00
ZProger
5b42e3d972 feat: custom year range on Cash Flow and Reports, drop redundant 12m preset
"This year" and "12 months" were two different ways of showing roughly
the same recent window, which read as duplicated. Replaced the "12m"
preset with "custom": pick an arbitrary fromYear-toYear span via a new
YearRangeSelector (two dropdowns built on the same internal component
YearSelector already uses).

Also de-duplicated the RangePreset/computeRange logic that was copied
verbatim between CashFlowPage and ReportsPage into shared
lib/dateRange.ts — both pages had the identical bug/duplication.
2026-08-16 22:23:25 +03:00
ZProger
acff447673 redesign: YearSelector as a compact dropdown next to MonthSelector
The pill-row year switcher from the previous commit added a whole
extra row of buttons above the month pills, which read as cluttered.
Replaced it with a single dropdown button (current year + chevron)
placed to the right of MonthSelector on all three pages, matching how
a lot of finance-app date pickers separate month (frequent) from year
(occasional) navigation.
2026-08-16 22:15:17 +03:00
ZProger
f3fbe4d546 feat: add year switcher to Dashboard, Transactions and Budget
Year was previously hardcoded to the current year on all three pages
(useState with no setter) — only the month could be changed via
MonthSelector, making it impossible to look at or compare older years
even though transaction history goes back further than the current
year.

Adds GET /transactions/years (contiguous range from the earliest
transaction through the current year) and a YearSelector component
matching MonthSelector's style, wired into all three pages alongside
a real year useState.
2026-08-16 22:10:49 +03:00
ZProger
e9eae92975 fix: long unbroken transaction description broke Dashboard layout
Card had no min-width: 0, so as a direct CSS Grid child on the
Dashboard it would grow to fit nowrap (truncate) text instead of
letting the ellipsis kick in — classic grid blowout. Reproduced with
Playwright (scrollWidth 2143px vs 1440px viewport before the fix,
matches after). Fixing it on the shared Card primitive protects every
grid/flex layout that uses it, not just Dashboard.
2026-08-16 22:00:56 +03:00
ZProger
c905cea84e fix: Recent Transactions widget ignored the selected dashboard month
RecentTransactionsCard queried transactions without year/month filters,
so it always showed the latest 6 transactions globally instead of the
ones for the month picked in the MonthSelector. DashboardPage now
passes its year/month state down to the card, which forwards it to
useTransactions.
2026-08-16 21:51:32 +03:00
ZProger
fe9b079c12 Initial public release
Aurum — a self-hosted personal finance operating system: cash flow,
net worth tracking, budgets, goals, recurring payments, reports,
proactive alerts, and a compound-interest returns calculator, all
bilingual (RU/EN) and mobile-first. Ships as a three-container Docker
Compose stack (Postgres + FastAPI + nginx-served React frontend).

See README.md for setup and CONTRIBUTING.md for development.
2026-08-16 18:39:52 +03:00