mirror of
https://github.com/mattintech/simplefileupload-server.git
synced 2026-07-11 14:21:53 +00:00
Migrate storage from JSON to SQLite with enhanced MVC architecture
- Replace JSON file storage with SQLite database for improved concurrency and data integrity - Implement repository pattern with dedicated model layer (admin_model, file_model, chunk_model) - Add database.py with automatic migration from existing JSON files - Enable WAL mode for thread-safe concurrent access across Gunicorn workers - Store database files in dedicated db/ folder - Update controllers to use model layer instead of direct JSON access - Add admin authentication system with TOTP 2FA support
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
from .file_metadata import FileMetadata
|
||||
|
||||
# Database initialization
|
||||
from .database import init_db, get_db_connection, migrate_from_json
|
||||
|
||||
# Admin model functions
|
||||
from .admin_model import (
|
||||
get_admin,
|
||||
create_admin,
|
||||
admin_exists as model_admin_exists,
|
||||
update_last_login
|
||||
)
|
||||
|
||||
# File model functions
|
||||
from .file_model import (
|
||||
create_file,
|
||||
get_file,
|
||||
increment_download,
|
||||
delete_file as model_delete_file,
|
||||
get_expired_files,
|
||||
cleanup_expired,
|
||||
get_all_files
|
||||
)
|
||||
|
||||
# Chunk model functions
|
||||
from .chunk_model import (
|
||||
create_session,
|
||||
get_session,
|
||||
add_chunk,
|
||||
get_received_chunks,
|
||||
delete_session,
|
||||
get_abandoned_sessions,
|
||||
cleanup_abandoned,
|
||||
update_received_chunks
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user