feat(upload): слой загрузки документов + регистрация в app.py

POST /upload (multipart/form-data: file):
  1. Сохраняет original_bytes в documents (status='uploaded')
  2. parser.parse() → elements
  3. textify.to_text() → parsed_text
  4. UPDATE documents SET parsed_text, status='parsed'
  5. Возвращает {document_id, filename, status, elements_count}

При ошибке парсинга: status='error', error_message, 422
This commit is contained in:
2026-06-14 06:11:23 +04:00
parent ba2e8552e7
commit 8db35e3b9d
2 changed files with 118 additions and 0 deletions
+2
View File
@@ -15,6 +15,7 @@ from flask import Flask, render_template
import db
import schema
from test_routes import test_bp
from upload import upload_bp
load_dotenv()
@@ -43,6 +44,7 @@ class ContractsApp:
# -- Blueprint-ы (каждый слой — отдельный Blueprint) --
self.app.register_blueprint(test_bp)
self.app.register_blueprint(upload_bp)
# self.app.register_blueprint(api_bp) # ← будет добавлен позже
def _index(self):