Compare commits
24 Commits
fix-pdf-pa
...
0589da5005
| Author | SHA1 | Date | |
|---|---|---|---|
| 0589da5005 | |||
| c50e48d564 | |||
|
|
01b1f26553 | ||
|
|
ba3105bbe5 | ||
| f32a21f87a | |||
|
|
8b57dd987e | ||
| ea234ea007 | |||
|
|
db4d5e4d00 | ||
| 358fcaeff5 | |||
|
|
67fed57118 | ||
| 45a6f3d374 | |||
|
|
aaf8cacf75 | ||
|
|
e28d0f46d0 | ||
| 22be09c101 | |||
|
|
78c4730196 | ||
| f2d0c91488 | |||
|
|
1d7fbea9ef | ||
|
|
627706228b | ||
|
|
a5f2294440 | ||
| 25ddd6b7ed | |||
|
|
3e481d5a55 | ||
| cf24d5dc26 | |||
|
|
723df494ca | ||
| 5fa6b921d8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ history.xlsx
|
|||||||
match_analysis.py
|
match_analysis.py
|
||||||
match_report.txt
|
match_report.txt
|
||||||
statements/
|
statements/
|
||||||
|
.cursor/
|
||||||
|
|||||||
@@ -27,13 +27,10 @@ FROM node:20-alpine AS runner
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# @napi-rs/canvas (dep of pdf-parse) ships a musl pre-built binary that
|
|
||||||
# needs these compatibility / font libraries at runtime.
|
|
||||||
RUN apk add --no-cache libc6-compat fontconfig freetype
|
|
||||||
|
|
||||||
COPY --from=build /app/backend/dist ./dist
|
COPY --from=build /app/backend/dist ./dist
|
||||||
COPY --from=build /app/backend/package.json ./package.json
|
COPY --from=build /app/backend/package.json ./package.json
|
||||||
COPY --from=build /app/node_modules ./node_modules
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY --from=build /app/backend/node_modules/ ./node_modules/
|
||||||
COPY backend/.env .env
|
COPY backend/.env .env
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"express": "^5.2.1",
|
"express": "^5.2.1",
|
||||||
"multer": "^2.1.1",
|
"multer": "^2.1.1",
|
||||||
"openai": "^6.27.0",
|
"openai": "^6.27.0",
|
||||||
"pdf-parse": "^2.4.5",
|
"pdf-parse": "1.1.1",
|
||||||
"pg": "^8.19.0",
|
"pg": "^8.19.0",
|
||||||
"uuid": "^13.0.0"
|
"uuid": "^13.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { requireAuth } from './middleware/auth';
|
|||||||
|
|
||||||
import authRouter from './routes/auth';
|
import authRouter from './routes/auth';
|
||||||
import importRouter from './routes/import';
|
import importRouter from './routes/import';
|
||||||
|
import importsRouter from './routes/imports';
|
||||||
import transactionsRouter from './routes/transactions';
|
import transactionsRouter from './routes/transactions';
|
||||||
import accountsRouter from './routes/accounts';
|
import accountsRouter from './routes/accounts';
|
||||||
import categoriesRouter from './routes/categories';
|
import categoriesRouter from './routes/categories';
|
||||||
@@ -26,6 +27,7 @@ app.use('/api/auth', authRouter);
|
|||||||
// All remaining /api routes require authentication
|
// All remaining /api routes require authentication
|
||||||
app.use('/api', requireAuth);
|
app.use('/api', requireAuth);
|
||||||
app.use('/api/import', importRouter);
|
app.use('/api/import', importRouter);
|
||||||
|
app.use('/api/imports', importsRouter);
|
||||||
app.use('/api/transactions', transactionsRouter);
|
app.use('/api/transactions', transactionsRouter);
|
||||||
app.use('/api/accounts', accountsRouter);
|
app.use('/api/accounts', accountsRouter);
|
||||||
app.use('/api/categories', categoriesRouter);
|
app.use('/api/categories', categoriesRouter);
|
||||||
|
|||||||
@@ -133,6 +133,24 @@ const migrations: { name: string; sql: string }[] = [
|
|||||||
AND NOT EXISTS (SELECT 1 FROM category_rules LIMIT 1);
|
AND NOT EXISTS (SELECT 1 FROM category_rules LIMIT 1);
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '005_imports_table',
|
||||||
|
sql: `
|
||||||
|
CREATE TABLE IF NOT EXISTS imports (
|
||||||
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
imported_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
account_id BIGINT REFERENCES accounts(id),
|
||||||
|
bank TEXT NOT NULL,
|
||||||
|
account_number_masked TEXT NOT NULL,
|
||||||
|
imported_count INT NOT NULL,
|
||||||
|
duplicates_skipped INT NOT NULL,
|
||||||
|
total_in_file INT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE transactions
|
||||||
|
ADD COLUMN IF NOT EXISTS import_id BIGINT REFERENCES imports(id);
|
||||||
|
`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '004_seed_category_rules_extended',
|
name: '004_seed_category_rules_extended',
|
||||||
sql: `
|
sql: `
|
||||||
@@ -176,6 +194,24 @@ const migrations: { name: string; sql: string }[] = [
|
|||||||
AND EXISTS (SELECT 1 FROM categories LIMIT 1);
|
AND EXISTS (SELECT 1 FROM categories LIMIT 1);
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '005_imports_table',
|
||||||
|
sql: `
|
||||||
|
CREATE TABLE IF NOT EXISTS imports (
|
||||||
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
imported_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
account_id BIGINT REFERENCES accounts(id),
|
||||||
|
bank TEXT NOT NULL,
|
||||||
|
account_number_masked TEXT NOT NULL,
|
||||||
|
imported_count INT NOT NULL,
|
||||||
|
duplicates_skipped INT NOT NULL,
|
||||||
|
total_in_file INT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE transactions
|
||||||
|
ADD COLUMN IF NOT EXISTS import_id BIGINT REFERENCES imports(id);
|
||||||
|
`,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function runMigrations(): Promise<void> {
|
export async function runMigrations(): Promise<void> {
|
||||||
|
|||||||
36
backend/src/routes/imports.ts
Normal file
36
backend/src/routes/imports.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { pool } from '../db/pool';
|
||||||
|
import { asyncHandler } from '../utils';
|
||||||
|
import * as importsService from '../services/imports';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/',
|
||||||
|
asyncHandler(async (_req, res) => {
|
||||||
|
const imports = await importsService.getImports();
|
||||||
|
res.json(imports);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
router.delete(
|
||||||
|
'/:id',
|
||||||
|
asyncHandler(async (req, res) => {
|
||||||
|
const id = Number(req.params.id);
|
||||||
|
if (isNaN(id)) {
|
||||||
|
res.status(400).json({ error: 'BAD_REQUEST', message: 'Invalid import id' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { rows } = await pool.query('SELECT 1 FROM imports WHERE id = $1', [id]);
|
||||||
|
if (rows.length === 0) {
|
||||||
|
res.status(404).json({ error: 'NOT_FOUND', message: 'Import not found' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await importsService.deleteImport(id);
|
||||||
|
res.json(result);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -155,6 +155,16 @@ export async function importStatement(
|
|||||||
isNewAccount = true;
|
isNewAccount = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create import record (counts updated after loop)
|
||||||
|
const accountNumberMasked = maskAccountNumber(data.statement.accountNumber);
|
||||||
|
const importResult = await client.query(
|
||||||
|
`INSERT INTO imports (account_id, bank, account_number_masked, imported_count, duplicates_skipped, total_in_file)
|
||||||
|
VALUES ($1, $2, $3, 0, 0, $4)
|
||||||
|
RETURNING id`,
|
||||||
|
[accountId, data.bank, accountNumberMasked, data.transactions.length],
|
||||||
|
);
|
||||||
|
const importId = Number(importResult.rows[0].id);
|
||||||
|
|
||||||
// Insert transactions
|
// Insert transactions
|
||||||
const insertedIds: number[] = [];
|
const insertedIds: number[] = [];
|
||||||
|
|
||||||
@@ -164,11 +174,11 @@ export async function importStatement(
|
|||||||
|
|
||||||
const result = await client.query(
|
const result = await client.query(
|
||||||
`INSERT INTO transactions
|
`INSERT INTO transactions
|
||||||
(account_id, operation_at, amount_signed, commission, description, direction, fingerprint, category_id, is_category_confirmed)
|
(account_id, operation_at, amount_signed, commission, description, direction, fingerprint, category_id, is_category_confirmed, import_id)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, NULL, FALSE)
|
VALUES ($1, $2, $3, $4, $5, $6, $7, NULL, FALSE, $8)
|
||||||
ON CONFLICT (account_id, fingerprint) DO NOTHING
|
ON CONFLICT (account_id, fingerprint) DO NOTHING
|
||||||
RETURNING id`,
|
RETURNING id`,
|
||||||
[accountId, tx.operationAt, tx.amountSigned, tx.commission, tx.description, dir, fp],
|
[accountId, tx.operationAt, tx.amountSigned, tx.commission, tx.description, dir, fp, importId],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.rows.length > 0) {
|
if (result.rows.length > 0) {
|
||||||
@@ -176,6 +186,13 @@ export async function importStatement(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update import record with actual counts
|
||||||
|
const duplicatesSkipped = data.transactions.length - insertedIds.length;
|
||||||
|
await client.query(
|
||||||
|
`UPDATE imports SET imported_count = $1, duplicates_skipped = $2 WHERE id = $3`,
|
||||||
|
[insertedIds.length, duplicatesSkipped, importId],
|
||||||
|
);
|
||||||
|
|
||||||
// Auto-categorize newly inserted transactions
|
// Auto-categorize newly inserted transactions
|
||||||
if (insertedIds.length > 0) {
|
if (insertedIds.length > 0) {
|
||||||
await client.query(
|
await client.query(
|
||||||
@@ -208,7 +225,7 @@ export async function importStatement(
|
|||||||
return {
|
return {
|
||||||
accountId,
|
accountId,
|
||||||
isNewAccount,
|
isNewAccount,
|
||||||
accountNumberMasked: maskAccountNumber(data.statement.accountNumber),
|
accountNumberMasked,
|
||||||
imported: insertedIds.length,
|
imported: insertedIds.length,
|
||||||
duplicatesSkipped: data.transactions.length - insertedIds.length,
|
duplicatesSkipped: data.transactions.length - insertedIds.length,
|
||||||
totalInFile: data.transactions.length,
|
totalInFile: data.transactions.length,
|
||||||
|
|||||||
44
backend/src/services/imports.ts
Normal file
44
backend/src/services/imports.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { pool } from '../db/pool';
|
||||||
|
import type { Import } from '@family-budget/shared';
|
||||||
|
|
||||||
|
export async function getImports(): Promise<Import[]> {
|
||||||
|
const result = await pool.query(
|
||||||
|
`SELECT
|
||||||
|
i.id,
|
||||||
|
i.imported_at,
|
||||||
|
i.account_id,
|
||||||
|
a.alias AS account_alias,
|
||||||
|
i.bank,
|
||||||
|
i.account_number_masked,
|
||||||
|
i.imported_count,
|
||||||
|
i.duplicates_skipped,
|
||||||
|
i.total_in_file
|
||||||
|
FROM imports i
|
||||||
|
LEFT JOIN accounts a ON a.id = i.account_id
|
||||||
|
ORDER BY i.imported_at DESC`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return result.rows.map((r) => ({
|
||||||
|
id: Number(r.id),
|
||||||
|
importedAt: r.imported_at.toISOString(),
|
||||||
|
accountId: r.account_id != null ? Number(r.account_id) : null,
|
||||||
|
accountAlias: r.account_alias ?? null,
|
||||||
|
bank: r.bank,
|
||||||
|
accountNumberMasked: r.account_number_masked,
|
||||||
|
importedCount: Number(r.imported_count),
|
||||||
|
duplicatesSkipped: Number(r.duplicates_skipped),
|
||||||
|
totalInFile: Number(r.total_in_file),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteImport(id: number): Promise<{ deleted: number }> {
|
||||||
|
const result = await pool.query(
|
||||||
|
'DELETE FROM transactions WHERE import_id = $1 RETURNING id',
|
||||||
|
[id],
|
||||||
|
);
|
||||||
|
const deleted = result.rowCount ?? 0;
|
||||||
|
|
||||||
|
await pool.query('DELETE FROM imports WHERE id = $1', [id]);
|
||||||
|
|
||||||
|
return { deleted };
|
||||||
|
}
|
||||||
@@ -63,16 +63,14 @@ export function isPdfConversionError(r: unknown): r is PdfConversionError {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lazy-loaded to avoid crashing the app at startup — pdf-parse pulls in
|
// Lazy-loaded so the app starts even if pdf-parse is missing from node_modules.
|
||||||
// @napi-rs/canvas (native Skia binary) which may fail on Alpine.
|
let _pdfParse: ((buf: Buffer) => Promise<{ text: string }>) | undefined;
|
||||||
let _PDFParse: typeof import('pdf-parse')['PDFParse'] | undefined;
|
function getPdfParse() {
|
||||||
function loadPDFParse() {
|
if (!_pdfParse) {
|
||||||
if (!_PDFParse) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const mod = require('pdf-parse') as typeof import('pdf-parse');
|
_pdfParse = require('pdf-parse') as (buf: Buffer) => Promise<{ text: string }>;
|
||||||
_PDFParse = mod.PDFParse;
|
|
||||||
}
|
}
|
||||||
return _PDFParse;
|
return _pdfParse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function convertPdfToStatement(
|
export async function convertPdfToStatement(
|
||||||
@@ -88,11 +86,8 @@ export async function convertPdfToStatement(
|
|||||||
|
|
||||||
let text: string;
|
let text: string;
|
||||||
try {
|
try {
|
||||||
const PDFParse = loadPDFParse();
|
const result = await getPdfParse()(buffer);
|
||||||
const parser = new PDFParse({ data: buffer });
|
|
||||||
const result = await parser.getText();
|
|
||||||
text = result.text || '';
|
text = result.text || '';
|
||||||
await parser.destroy();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('PDF extraction error:', err);
|
console.error('PDF extraction error:', err);
|
||||||
return {
|
return {
|
||||||
@@ -113,6 +108,7 @@ export async function convertPdfToStatement(
|
|||||||
const openai = new OpenAI({
|
const openai = new OpenAI({
|
||||||
apiKey: config.llmApiKey,
|
apiKey: config.llmApiKey,
|
||||||
...(config.llmApiBaseUrl && { baseURL: config.llmApiBaseUrl }),
|
...(config.llmApiBaseUrl && { baseURL: config.llmApiBaseUrl }),
|
||||||
|
timeout: 5 * 60 * 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -124,7 +120,6 @@ export async function convertPdfToStatement(
|
|||||||
],
|
],
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
max_tokens: 32768,
|
max_tokens: 32768,
|
||||||
response_format: { type: 'json_object' },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const content = completion.choices[0]?.message?.content?.trim();
|
const content = completion.choices[0]?.message?.content?.trim();
|
||||||
@@ -164,7 +159,21 @@ export async function convertPdfToStatement(
|
|||||||
return {
|
return {
|
||||||
status: 502,
|
status: 502,
|
||||||
error: 'BAD_GATEWAY',
|
error: 'BAD_GATEWAY',
|
||||||
message: 'Временная ошибка конвертации',
|
message: extractLlmErrorMessage(err),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extractLlmErrorMessage(err: unknown): string {
|
||||||
|
const raw = String(
|
||||||
|
(err as Record<string, unknown>)?.message ??
|
||||||
|
(err as Record<string, Record<string, unknown>>)?.error?.message ?? '',
|
||||||
|
);
|
||||||
|
if (/context.length|n_ctx|too.many.tokens|maximum.context/i.test(raw)) {
|
||||||
|
return 'PDF-файл слишком большой для обработки. Попробуйте файл с меньшим количеством операций или используйте модель с большим контекстным окном.';
|
||||||
|
}
|
||||||
|
if (/timeout|timed?\s*out|ETIMEDOUT|ECONNREFUSED/i.test(raw)) {
|
||||||
|
return 'LLM-сервер не отвечает. Проверьте, что сервер запущен и доступен.';
|
||||||
|
}
|
||||||
|
return 'Временная ошибка конвертации';
|
||||||
|
}
|
||||||
|
|||||||
@@ -171,5 +171,6 @@ export async function updateTransaction(
|
|||||||
|
|
||||||
export async function clearAllTransactions(): Promise<{ deleted: number }> {
|
export async function clearAllTransactions(): Promise<{ deleted: number }> {
|
||||||
const result = await pool.query('DELETE FROM transactions RETURNING id');
|
const result = await pool.query('DELETE FROM transactions RETURNING id');
|
||||||
|
await pool.query('DELETE FROM imports');
|
||||||
return { deleted: result.rowCount ?? 0 };
|
return { deleted: result.rowCount ?? 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="theme-color" content="#0f172a" />
|
<meta name="theme-color" content="#0f172a" />
|
||||||
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||||
<title>Семейный бюджет</title>
|
<title>Семейный бюджет</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|||||||
@@ -3,6 +3,20 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# Import endpoint — long timeout for LLM processing
|
||||||
|
location /api/import {
|
||||||
|
proxy_pass http://family-budget-backend:3000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_cookie_path / /;
|
||||||
|
proxy_connect_timeout 5s;
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
client_max_body_size 15m;
|
||||||
|
}
|
||||||
|
|
||||||
# API — проксируем на backend (сервис из docker-compose)
|
# API — проксируем на backend (сервис из docker-compose)
|
||||||
location /api {
|
location /api {
|
||||||
proxy_pass http://family-budget-backend:3000;
|
proxy_pass http://family-budget-backend:3000;
|
||||||
|
|||||||
4
frontend/public/favicon.svg
Normal file
4
frontend/public/favicon.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
|
||||||
|
<rect width="32" height="32" rx="8" fill="#0f172a"/>
|
||||||
|
<text x="16" y="23" font-family="Georgia, serif" font-size="20" font-weight="bold" fill="#3b82f6" text-anchor="middle">₽</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 271 B |
@@ -1,4 +1,7 @@
|
|||||||
import type { ImportStatementResponse } from '@family-budget/shared';
|
import type {
|
||||||
|
ImportStatementResponse,
|
||||||
|
Import,
|
||||||
|
} from '@family-budget/shared';
|
||||||
import { api } from './client';
|
import { api } from './client';
|
||||||
|
|
||||||
export async function importStatement(
|
export async function importStatement(
|
||||||
@@ -11,3 +14,13 @@ export async function importStatement(
|
|||||||
formData,
|
formData,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getImports(): Promise<Import[]> {
|
||||||
|
return api.get<Import[]>('/api/imports');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteImport(
|
||||||
|
id: number,
|
||||||
|
): Promise<{ deleted: number }> {
|
||||||
|
return api.delete<{ deleted: number }>(`/api/imports/${id}`);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,87 @@
|
|||||||
import { useState } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { ClearHistoryModal } from './ClearHistoryModal';
|
import { ClearHistoryModal } from './ClearHistoryModal';
|
||||||
|
import { DeleteImportModal } from './DeleteImportModal';
|
||||||
|
import { getImports } from '../api/import';
|
||||||
|
import type { Import } from '@family-budget/shared';
|
||||||
|
|
||||||
|
function formatDate(iso: string): string {
|
||||||
|
const d = new Date(iso);
|
||||||
|
return d.toLocaleString('ru-RU', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function DataSection() {
|
export function DataSection() {
|
||||||
const [showClearModal, setShowClearModal] = useState(false);
|
const [showClearModal, setShowClearModal] = useState(false);
|
||||||
|
const [imports, setImports] = useState<Import[]>([]);
|
||||||
|
const [impToDelete, setImpToDelete] = useState<Import | null>(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getImports().then(setImports).catch(() => {});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleImportDeleted = () => {
|
||||||
|
setImpToDelete(null);
|
||||||
|
getImports().then(setImports).catch(() => {});
|
||||||
|
navigate('/history');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="data-section">
|
<div className="data-section">
|
||||||
|
<div className="section-block">
|
||||||
|
<h3>История импортов</h3>
|
||||||
|
<p className="section-desc">
|
||||||
|
Список импортов выписок. Можно удалить операции конкретного импорта.
|
||||||
|
</p>
|
||||||
|
{imports.length === 0 ? (
|
||||||
|
<p className="muted">Импортов пока нет.</p>
|
||||||
|
) : (
|
||||||
|
<div className="table-responsive">
|
||||||
|
<table className="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Дата</th>
|
||||||
|
<th>Счёт</th>
|
||||||
|
<th>Банк</th>
|
||||||
|
<th>Импортировано</th>
|
||||||
|
<th>Дубликаты</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{imports.map((imp) => (
|
||||||
|
<tr key={imp.id}>
|
||||||
|
<td>{formatDate(imp.importedAt)}</td>
|
||||||
|
<td>
|
||||||
|
{imp.accountAlias || imp.accountNumberMasked || '—'}
|
||||||
|
</td>
|
||||||
|
<td>{imp.bank}</td>
|
||||||
|
<td>{imp.importedCount}</td>
|
||||||
|
<td>{imp.duplicatesSkipped}</td>
|
||||||
|
<td>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-sm btn-danger"
|
||||||
|
onClick={() => setImpToDelete(imp)}
|
||||||
|
disabled={imp.importedCount === 0}
|
||||||
|
>
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="section-block">
|
<div className="section-block">
|
||||||
<h3>Очистка данных</h3>
|
<h3>Очистка данных</h3>
|
||||||
<p className="section-desc">
|
<p className="section-desc">
|
||||||
@@ -32,6 +106,14 @@ export function DataSection() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{impToDelete && (
|
||||||
|
<DeleteImportModal
|
||||||
|
imp={impToDelete}
|
||||||
|
onClose={() => setImpToDelete(null)}
|
||||||
|
onDone={handleImportDeleted}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
70
frontend/src/components/DeleteImportModal.tsx
Normal file
70
frontend/src/components/DeleteImportModal.tsx
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { deleteImport } from '../api/import';
|
||||||
|
import type { Import } from '@family-budget/shared';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
imp: Import;
|
||||||
|
onClose: () => void;
|
||||||
|
onDone: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DeleteImportModal({ imp, onClose, onDone }: Props) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [error, setError] = useState('');
|
||||||
|
|
||||||
|
const accountLabel =
|
||||||
|
imp.accountAlias || imp.accountNumberMasked || `ID ${imp.accountId}`;
|
||||||
|
|
||||||
|
const handleConfirm = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
setError('');
|
||||||
|
try {
|
||||||
|
await deleteImport(imp.id);
|
||||||
|
onDone();
|
||||||
|
} catch (e) {
|
||||||
|
setError(
|
||||||
|
e instanceof Error ? e.message : 'Ошибка при удалении импорта',
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
|
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||||
|
<div className="modal-header">
|
||||||
|
<h2>Удалить импорт</h2>
|
||||||
|
<button className="btn-close" onClick={onClose}>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="modal-body">
|
||||||
|
<p className="clear-history-warn">
|
||||||
|
Будут удалены все операции этого импорта ({imp.importedCount}{' '}
|
||||||
|
шт.): {imp.bank} / {accountLabel}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{error && <div className="alert alert-error">{error}</div>}
|
||||||
|
|
||||||
|
<p>Действие необратимо.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="modal-footer">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-danger"
|
||||||
|
onClick={handleConfirm}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
{loading ? 'Удаление…' : 'Удалить'}
|
||||||
|
</button>
|
||||||
|
<button type="button" className="btn btn-secondary" onClick={onClose}>
|
||||||
|
Отмена
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
255
package-lock.json
generated
255
package-lock.json
generated
@@ -24,7 +24,7 @@
|
|||||||
"express": "^5.2.1",
|
"express": "^5.2.1",
|
||||||
"multer": "^2.1.1",
|
"multer": "^2.1.1",
|
||||||
"openai": "^6.27.0",
|
"openai": "^6.27.0",
|
||||||
"pdf-parse": "^2.4.5",
|
"pdf-parse": "1.1.1",
|
||||||
"pg": "^8.19.0",
|
"pg": "^8.19.0",
|
||||||
"uuid": "^13.0.0"
|
"uuid": "^13.0.0"
|
||||||
},
|
},
|
||||||
@@ -40,6 +40,28 @@
|
|||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"backend/node_modules/debug": {
|
||||||
|
"version": "3.2.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||||
|
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"backend/node_modules/pdf-parse": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/pdf-parse/-/pdf-parse-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-v6ZJ/efsBpGrGGknjtq9J/oC8tZWq0KWL5vQrk2GlzLEQPUDB1ex+13Rmidl1neNN358Jn9EHZw5y07FFtaC7A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^3.1.0",
|
||||||
|
"node-ensure": "^0.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"frontend": {
|
"frontend": {
|
||||||
"name": "@family-budget/frontend",
|
"name": "@family-budget/frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
@@ -89,6 +111,7 @@
|
|||||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.0",
|
"@babel/code-frame": "^7.29.0",
|
||||||
"@babel/generator": "^7.29.0",
|
"@babel/generator": "^7.29.0",
|
||||||
@@ -853,190 +876,6 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@napi-rs/canvas": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-DxuT1ClnIPts1kQx8FBmkk4BQDTfI5kIzywAaMjQSXfNnra5UFU9PwurXrl+Je3bJ6BGsp/zmshVVFbCmyI+ww==",
|
|
||||||
"license": "MIT",
|
|
||||||
"workspaces": [
|
|
||||||
"e2e/*"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"@napi-rs/canvas-android-arm64": "0.1.80",
|
|
||||||
"@napi-rs/canvas-darwin-arm64": "0.1.80",
|
|
||||||
"@napi-rs/canvas-darwin-x64": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-arm64-gnu": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-arm64-musl": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-riscv64-gnu": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-x64-gnu": "0.1.80",
|
|
||||||
"@napi-rs/canvas-linux-x64-musl": "0.1.80",
|
|
||||||
"@napi-rs/canvas-win32-x64-msvc": "0.1.80"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-android-arm64": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-sk7xhN/MoXeuExlggf91pNziBxLPVUqF2CAVnB57KLG/pz7+U5TKG8eXdc3pm0d7Od0WreB6ZKLj37sX9muGOQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"android"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-darwin-arm64": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-O64APRTXRUiAz0P8gErkfEr3lipLJgM6pjATwavZ22ebhjYl/SUbpgM0xcWPQBNMP1n29afAC/Us5PX1vg+JNQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-darwin-x64": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-FqqSU7qFce0Cp3pwnTjVkKjjOtxMqRe6lmINxpIZYaZNnVI0H5FtsaraZJ36SiTHNjZlUB69/HhxNDT1Aaa9vA==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-arm-gnueabihf": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-eyWz0ddBDQc7/JbAtY4OtZ5SpK8tR4JsCYEZjCE3dI8pqoWUC8oMwYSBGCYfsx2w47cQgQCgMVRVTFiiO38hHQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-arm64-gnu": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-qwA63t8A86bnxhuA/GwOkK3jvb+XTQaTiVML0vAWoHyoZYTjNs7BzoOONDgTnNtr8/yHrq64XXzUoLqDzU+Uuw==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-arm64-musl": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-1XbCOz/ymhj24lFaIXtWnwv/6eFHXDrjP0jYkc6iHQ9q8oXKzUX1Lc6bu+wuGiLhGh2GS/2JlfORC5ZcXimRcg==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-riscv64-gnu": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-XTzR125w5ZMs0lJcxRlS1K3P5RaZ9RmUsPtd1uGt+EfDyYMu4c6SEROYsxyatbbu/2+lPe7MPHOO/0a0x7L/gw==",
|
|
||||||
"cpu": [
|
|
||||||
"riscv64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-x64-gnu": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-BeXAmhKg1kX3UCrJsYbdQd3hIMDH/K6HnP/pG2LuITaXhXBiNdh//TVVVVCBbJzVQaV5gK/4ZOCMrQW9mvuTqA==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-linux-x64-musl": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-x0XvZWdHbkgdgucJsRxprX/4o4sEed7qo9rCQA9ugiS9qE2QvP0RIiEugtZhfLH3cyI+jIRFJHV4Fuz+1BHHMg==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@napi-rs/canvas-win32-x64-msvc": {
|
|
||||||
"version": "0.1.80",
|
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.80.tgz",
|
|
||||||
"integrity": "sha512-Z8jPsM6df5V8B1HrCHB05+bDiCxjE9QA//3YrkKIdVDEwn5RKaqOxCJDRJkl48cJbylcrJbW4HxZbTte8juuPg==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@rolldown/pluginutils": {
|
"node_modules/@rolldown/pluginutils": {
|
||||||
"version": "1.0.0-beta.27",
|
"version": "1.0.0-beta.27",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
|
||||||
@@ -1556,6 +1395,7 @@
|
|||||||
"integrity": "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==",
|
"integrity": "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/body-parser": "*",
|
"@types/body-parser": "*",
|
||||||
"@types/express-serve-static-core": "^5.0.0",
|
"@types/express-serve-static-core": "^5.0.0",
|
||||||
@@ -1634,6 +1474,7 @@
|
|||||||
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"csstype": "^3.2.2"
|
"csstype": "^3.2.2"
|
||||||
}
|
}
|
||||||
@@ -1773,6 +1614,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.9.0",
|
"baseline-browser-mapping": "^2.9.0",
|
||||||
"caniuse-lite": "^1.0.30001759",
|
"caniuse-lite": "^1.0.30001759",
|
||||||
@@ -2796,6 +2638,12 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-ensure": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz",
|
||||||
|
"integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.27",
|
"version": "2.0.27",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
|
||||||
@@ -2885,43 +2733,12 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pdf-parse": {
|
|
||||||
"version": "2.4.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/pdf-parse/-/pdf-parse-2.4.5.tgz",
|
|
||||||
"integrity": "sha512-mHU89HGh7v+4u2ubfnevJ03lmPgQ5WU4CxAVmTSh/sxVTEDYd1er/dKS/A6vg77NX47KTEoihq8jZBLr8Cxuwg==",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@napi-rs/canvas": "0.1.80",
|
|
||||||
"pdfjs-dist": "5.4.296"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"pdf-parse": "bin/cli.mjs"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=20.16.0 <21 || >=22.3.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/mehmet-kozan"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pdfjs-dist": {
|
|
||||||
"version": "5.4.296",
|
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.4.296.tgz",
|
|
||||||
"integrity": "sha512-DlOzet0HO7OEnmUmB6wWGJrrdvbyJKftI1bhMitK7O2N8W2gc757yyYBbINy9IDafXAV9wmKr9t7xsTaNKRG5Q==",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=20.16.0 || >=22.3.0"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"@napi-rs/canvas": "^0.1.80"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pg": {
|
"node_modules/pg": {
|
||||||
"version": "8.19.0",
|
"version": "8.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/pg/-/pg-8.19.0.tgz",
|
||||||
"integrity": "sha512-QIcLGi508BAHkQ3pJNptsFz5WQMlpGbuBGBaIaXsWK8mel2kQ/rThYI+DbgjUvZrIr7MiuEuc9LcChJoEZK1xQ==",
|
"integrity": "sha512-QIcLGi508BAHkQ3pJNptsFz5WQMlpGbuBGBaIaXsWK8mel2kQ/rThYI+DbgjUvZrIr7MiuEuc9LcChJoEZK1xQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pg-connection-string": "^2.11.0",
|
"pg-connection-string": "^2.11.0",
|
||||||
"pg-pool": "^3.12.0",
|
"pg-pool": "^3.12.0",
|
||||||
@@ -3019,6 +2836,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -3168,6 +2986,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",
|
||||||
"integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",
|
"integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -3177,6 +2996,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
|
||||||
"integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",
|
"integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
@@ -4288,6 +4108,7 @@
|
|||||||
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.4.4",
|
"fdir": "^6.4.4",
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
/** Import record from imports table (for import history) */
|
||||||
|
export interface Import {
|
||||||
|
id: number;
|
||||||
|
importedAt: string;
|
||||||
|
accountId: number | null;
|
||||||
|
accountAlias: string | null;
|
||||||
|
bank: string;
|
||||||
|
accountNumberMasked: string;
|
||||||
|
importedCount: number;
|
||||||
|
duplicatesSkipped: number;
|
||||||
|
totalInFile: number;
|
||||||
|
}
|
||||||
|
|
||||||
/** JSON 1.0 statement file — the shape accepted by POST /api/import/statement */
|
/** JSON 1.0 statement file — the shape accepted by POST /api/import/statement */
|
||||||
export interface StatementFile {
|
export interface StatementFile {
|
||||||
schemaVersion: '1.0';
|
schemaVersion: '1.0';
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export type {
|
|||||||
StatementHeader,
|
StatementHeader,
|
||||||
StatementTransaction,
|
StatementTransaction,
|
||||||
ImportStatementResponse,
|
ImportStatementResponse,
|
||||||
|
Import,
|
||||||
} from './import';
|
} from './import';
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
|
|||||||
Reference in New Issue
Block a user