fix: allow investment rules and label accounts
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [Frontend 0.10.1 / Backend 0.7.1] - 2026-08-20
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Account labels are shown in analytics filters, and account defaults now remain overridable by matching category rules.
|
||||||
|
|
||||||
## [Frontend 0.10.0 / Backend 0.7.0 / Shared 0.3.0] - 2026-08-20
|
## [Frontend 0.10.0 / Backend 0.7.0 / Shared 0.3.0] - 2026-08-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@family-budget/backend",
|
"name": "@family-budget/backend",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx watch src/app.ts",
|
"dev": "tsx watch src/app.ts",
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export async function updateAccount(
|
|||||||
await client.query(
|
await client.query(
|
||||||
`UPDATE transactions
|
`UPDATE transactions
|
||||||
SET category_id = (SELECT id FROM categories WHERE name = 'Инвестиции' AND type = 'transfer' LIMIT 1),
|
SET category_id = (SELECT id FROM categories WHERE name = 'Инвестиции' AND type = 'transfer' LIMIT 1),
|
||||||
direction = 'transfer', is_category_confirmed = TRUE, updated_at = NOW()
|
direction = 'transfer', is_category_confirmed = FALSE, updated_at = NOW()
|
||||||
WHERE account_id = $1 AND category_id IS NULL`,
|
WHERE account_id = $1 AND category_id IS NULL`,
|
||||||
[id],
|
[id],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ export async function importStatement(
|
|||||||
const categoryId = isCashbackCommissionImport
|
const categoryId = isCashbackCommissionImport
|
||||||
? incomeCategoryId
|
? incomeCategoryId
|
||||||
: isInvestmentAccount ? investmentCategoryId : null;
|
: isInvestmentAccount ? investmentCategoryId : null;
|
||||||
const isCategoryConfirmed = isCashbackCommissionImport || isInvestmentAccount;
|
const isCategoryConfirmed = isCashbackCommissionImport;
|
||||||
|
|
||||||
const result = await client.query(
|
const result = await client.query(
|
||||||
`INSERT INTO transactions
|
`INSERT INTO transactions
|
||||||
@@ -279,6 +279,13 @@ export async function importStatement(
|
|||||||
WHERE t.id = sub.tx_id`,
|
WHERE t.id = sub.tx_id`,
|
||||||
[insertedIds],
|
[insertedIds],
|
||||||
);
|
);
|
||||||
|
if (isInvestmentAccount && investmentCategoryId != null) {
|
||||||
|
await client.query(
|
||||||
|
`UPDATE transactions SET is_category_confirmed = TRUE, updated_at = NOW()
|
||||||
|
WHERE id = ANY($1::bigint[]) AND category_id = $2 AND is_category_confirmed = FALSE`,
|
||||||
|
[insertedIds, investmentCategoryId],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.query('COMMIT');
|
await client.query('COMMIT');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@family-budget/frontend",
|
"name": "@family-budget/frontend",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ export function TransactionFilters({
|
|||||||
<option value="">Все счета</option>
|
<option value="">Все счета</option>
|
||||||
{accounts.map((a) => (
|
{accounts.map((a) => (
|
||||||
<option key={a.id} value={a.id}>
|
<option key={a.id} value={a.id}>
|
||||||
{a.alias || a.accountNumberMasked}
|
{[a.alias || a.accountNumberMasked, a.accountType, a.status === 'closed' ? 'закрытый' : 'действующий'].filter(Boolean).join(' · ')}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export function AnalyticsPage() {
|
|||||||
<option value="">Все счета</option>
|
<option value="">Все счета</option>
|
||||||
{accounts.map((a) => (
|
{accounts.map((a) => (
|
||||||
<option key={a.id} value={a.id}>
|
<option key={a.id} value={a.id}>
|
||||||
{a.alias || a.accountNumberMasked}
|
{[a.alias || a.accountNumberMasked, a.accountType, a.status === 'closed' ? 'закрытый' : 'действующий'].filter(Boolean).join(' · ')}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user