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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user