Commit Graph

42 Commits

Author SHA1 Message Date
5835b4c626 Add HTTP exception helpers and update models
Introduced utils/http/http_exceptions.py with common HTTP exception helpers for FastAPI. Updated main.py to use a global exception handler that logs and hides internal errors. Refined models/README.md to document new models and relationships, including PhysicalFile and UploadSession, and updated DTO and enum documentation. Simplified ThemeResponse in models/color.py. Improved models/download.py with type annotations, index changes, and import optimizations. Fixed a parameter type in clean.py.

Co-Authored-By: 砂糖橘 <54745033+Foxerine@users.noreply.github.com>
2025-12-25 15:48:21 +08:00
44a8959aa5 feat: 更新验证码请求模型,添加 Google reCAPTCHA 和 Cloudflare Turnstile 验证功能
refactor: 修改用户状态字段类型,优化用户模型
fix: 修复启动服务的错误提示信息
refactor: 统一认证依赖,替换为 AuthRequired
docs: 添加用户会话刷新接口
2025-12-25 10:26:45 +08:00
16cec42181 feat: Implement file download token management and restructure file routes
- Added DownloadTokenManager for creating and verifying JWT download tokens.
- Introduced new download routes for creating download tokens and downloading files using tokens.
- Restructured file upload routes into a dedicated sub-router.
- Updated file upload session management with improved error handling and response structures.
- Created a new MCP (Microservice Communication Protocol) router with basic request and response models.
- Added base models for MCP requests and responses, including method enumeration.
2025-12-23 18:12:11 +08:00
446d219aca Refactor import statements for ResponseBase in API routers
- Updated import statements in the following files to import ResponseBase directly from models instead of models.response:
  - routers/api/v1/share/__init__.py
  - routers/api/v1/site/__init__.py
  - routers/api/v1/slave/__init__.py
  - routers/api/v1/tag/__init__.py
  - routers/api/v1/user/__init__.py
  - routers/api/v1/vas/__init__.py
  - routers/api/v1/webdav/__init__.py

Enhance user registration and related endpoints in user router

- Changed return type annotations from models.response.ResponseBase to models.ResponseBase in multiple functions.
- Updated return statements to reflect the new import structure.
- Improved documentation for clarity.

Add PhysicalFile model and storage service implementation

- Introduced PhysicalFile model to represent actual files on disk with reference counting logic.
- Created storage service module with local storage implementation, including file operations and error handling.
- Defined exceptions for storage operations to improve error handling.
- Implemented naming rule parser for generating file and directory names based on templates.

Update dependency management in uv.lock

- Added aiofiles version 25.1.0 to the project dependencies.
2025-12-23 12:20:06 +08:00
96bf447426 feat: 为多个模型的外键字段添加级联删除和其他约束 2025-12-23 11:00:09 +08:00
1a78c76d02 docs: 更新 README.md,修正模型基类名称并补充使用示例 2025-12-22 18:59:13 +08:00
a5efda9c23 feat(mixin): add TableBaseMixin and UUIDTableBaseMixin for async CRUD operations
- Implemented TableBaseMixin providing generic CRUD methods and automatic timestamp management.
- Introduced UUIDTableBaseMixin for models using UUID as primary keys.
- Added ListResponse for standardized paginated responses.
- Created TimeFilterRequest and PaginationRequest for filtering and pagination parameters.
- Enhanced get_with_count method to return both item list and total count.
- Included validation for time filter parameters in TimeFilterRequest.
- Improved documentation and usage examples throughout the code.
2025-12-22 18:29:14 +08:00
47a4756227 feat: 添加存储策略选项模型及其与策略的关系,更新相关文档 2025-12-22 15:12:13 +08:00
6c3a601259 Refactor GroupOptions model and update documentation
- Removed the `available_nodes` field from the GroupOptions model in `group.py`.
- Updated imports in `pwd.py` by removing unused imports.
- Added a comprehensive roadmap document outlining the development stages and features for DiskNext Server.
- Created a detailed README for the models directory, documenting the database models and their relationships.
2025-12-19 20:18:36 +08:00
f93cb3eedb Add unit tests for models and services
- Implemented unit tests for Object model including folder and file creation, properties, and path retrieval.
- Added unit tests for Setting model covering creation, unique constraints, and type enumeration.
- Created unit tests for User model focusing on user creation, uniqueness, and group relationships.
- Developed unit tests for Login service to validate login functionality, including 2FA and token generation.
- Added utility tests for JWT creation and verification, ensuring token integrity and expiration handling.
- Implemented password utility tests for password generation, hashing, and TOTP verification.
2025-12-19 19:48:05 +08:00
51b6de921b feat: Implement API routers for user, tag, vas, webdav, and slave functionalities
- Added user authentication and registration endpoints with JWT support.
- Created tag management routes for creating and deleting tags.
- Implemented value-added service (VAS) endpoints for managing storage packs and orders.
- Developed WebDAV account management routes for creating, updating, and deleting accounts.
- Introduced slave router for handling file uploads, downloads, and aria2 task management.
- Enhanced JWT utility functions for token creation and secret key management.
- Established lifespan management for FastAPI application startup and shutdown processes.
- Integrated password handling utilities with Argon2 hashing and two-factor authentication support.
2025-12-19 18:04:34 +08:00
11b67bde6d feat: 更新存储策略相关逻辑,使用 UUID 替代 int 类型,优化响应模型 2025-12-19 17:32:26 +08:00
922692b820 feat: 更新模型以支持 UUID,添加注册请求 DTO,重构用户注册逻辑 2025-12-19 16:32:49 +08:00
e031f3cc40 feat: 重构主题相关逻辑,移动 ThemeResponse 到 color.py,更新相关引用,优化目录路径处理 2025-12-19 15:35:34 +08:00
20753f1725 feat: 添加两步验证功能,重构相关逻辑,移除冗余代码 2025-12-19 14:30:13 +08:00
b7c5d5aec7 feat: 添加两步验证功能,优化用户登录逻辑,更新相关模型和依赖 2025-12-19 14:11:24 +08:00
89e837d91c feat: 重构模型和响应结构,优化用户和对象管理逻辑,添加 Dockerfile 2025-12-18 18:28:41 +08:00
68343c710b feat: 合并 File 和 Folder 模型为统一的 Object 模型,优化对象管理逻辑
refactor: 更新相关模型和路由以支持新对象模型,移除冗余代码
2025-12-18 17:18:40 +08:00
d271c81de7 feat: 更新用户组和选项模型,优化存储信息获取逻辑 2025-12-18 14:27:41 +08:00
8d2658b166 refactor: 移除 UserAuthn 模型中的表名定义 2025-12-18 14:06:35 +08:00
a977f5b261 优化数据表结构 2025-12-18 12:17:17 +08:00
8b6e18f0e2 feat: 更新数据模型和API路由,优化用户信息获取及设置管理 2025-12-02 21:36:19 +08:00
b02a4638da feat: add database session dependency for FastAPI routes
- Introduced a new dependency in `middleware/dependencies.py` to provide an asynchronous database session using SQLModel.
- This dependency can be utilized in route functions to facilitate database operations.
2025-11-27 22:18:50 +08:00
b364b740ca feat: Enhance models and README with additional features and improvements
- Updated README to include KodBox in project vision.
- Added model descriptions for clarity in Download, File, Folder, Group, Node, Order, Policy, Redeem, Report, Request, Response, Setting, Share, SourceLink, StoragePack, Tag, Task, User, and WebDAV.
- Changed optional fields from Optional[...] to the new union type syntax (e.g., str | None).
- Improved foreign key references in models for consistency.
- Refactored relationships in models to use singular forms where appropriate.
- Updated login service to reflect changes in request model types.
2025-11-27 21:22:40 +08:00
1533d9e89c Refactor code structure for improved readability and maintainability 2025-11-27 20:56:48 +08:00
0d45a07ba7 优化数据库模型与关系 2025-09-27 22:40:10 +08:00
cf5539f3c2 重构模型基类 2025-09-26 06:18:59 +08:00
2a173c0566 添加Github登录,优化数据库模型 2025-09-01 00:21:06 +08:00
f3a5ae9c40 优化部分代码实现 2025-08-28 02:23:26 +08:00
9f93f6040b 完成部分Github登录回调 2025-08-27 13:49:17 +08:00
4148e362b9 数据库时间日志迁移至 BaseModel 2025-07-18 00:50:19 +08:00
6f83022a79 新增获取用户信息 /api/user/me 2025-07-17 23:26:36 +08:00
e98c46f44a 用户登录 2025-07-17 19:33:48 +08:00
33cca4e271 修复数据库迁移问题、新增环境变量读写 2025-07-15 17:32:00 +08:00
dc522a8e93 新增读取用户与其单元测试 2025-07-14 15:43:02 +08:00
557a50f539 单元测试:新建用户与用户组 2025-07-14 15:13:05 +08:00
e011a1ea0e 完善 /api/site/config 路由,修复数据库无法二次启动 2025-07-02 00:42:54 +08:00
e84b3a7dee 完成数据库设置表的增删改查 2025-07-01 23:50:16 +08:00
652a78cb05 数据库优化 2025-07-01 00:16:07 +08:00
f6825b670f 数据库创建 2025-06-22 19:26:23 +08:00
6094d8219e 路由与数据表优化 2025-06-20 22:26:28 +08:00
eb3d2843eb 完成部分API路由以及文档 2025-06-18 02:14:37 +08:00