From 00ad74b5c2cd497033c34fdf678ad931e13a509d Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Tue, 19 Dec 2023 23:02:14 +0800 Subject: [PATCH] Prepare to lock the pydantic-v1 branch (#254) --- README.md | 15 +++------------ README.zh-CN.md | 14 +++----------- backend/app/api/v1/mixed/tests.py | 16 +++++++--------- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index dff81c21..e22add82 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ [![GitHub](https://img.shields.io/github/license/fastapi-practices/fastapi_best_architecture)](https://github.com/fastapi-practices/fastapi_best_architecture/blob/master/LICENSE) [![Static Badge](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/) +> [!TIP] +> You are viewing the pydantic-v1 branch, which is locked and no longer provides updates and fixes + English | [简体中文](./README.zh-CN.md) FastAPI framework based on the front-end and back-end separation of the middle and back-end solutions, follow @@ -49,10 +52,6 @@ See a preview of some of the screenshots - [x] Docker / Docker-compose deployment - [x] Pytest Unit Testing -TODO: - -1. [ ] Pydantic 2.0 - ## Built-in features 1. [x] User management: system user role management, permission assignment @@ -67,14 +66,6 @@ TODO: 10. [x] Scheduled tasks: automated tasks, asynchronous tasks, and function invocation are supported 11. [x] Interface Documentation: Automatically generate online interactive API interface documentation. -TODO: - -1. [ ] Dynamic Configuration: Dynamic configuration of the system environment (site title, logo, filing, footer...) -2. [ ] code generation: according to the table structure, visualize the generation of additions, deletions, - modifications and checks of the business code. -3. [ ] File Upload: Docking cloud OSS and local backup. -4. [ ] System Notification: proactively send timed task notifications, resource warnings, service anomaly warnings... - ## Local development * Python: 3.10+ diff --git a/README.zh-CN.md b/README.zh-CN.md index bdf50e95..fa8e06da 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -3,6 +3,9 @@ [![GitHub](https://img.shields.io/github/license/fastapi-practices/fastapi_best_architecture)](https://github.com/fastapi-practices/fastapi_best_architecture/blob/master/LICENSE) [![Static Badge](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/) +> [!TIP] +> 你正在查看 pydantic-v1 分支,此分支已被锁定,不再提供更新和修复 + 简体中文 | [English](./README.md) 基于 FastAPI 框架的前后端分离中后台解决方案,遵循[伪三层架构](#伪三层架构)设计, 支持 **python3.10** 及以上版本 @@ -44,10 +47,6 @@ mvc 架构作为常规设计模式,在 python web 中也很常见,但是三 - [x] Docker / Docker-compose 部署 - [x] Pytest 单元测试 -TODO: - -1. [ ] Pydantic 2.0 - ## 内置功能 1. [x] 用户管理:系统用户角色管理,权限分配 @@ -62,13 +61,6 @@ TODO: 10. [x] 定时任务:自动化任务,异步任务,支持函数调用 11. [x] 接口文档:自动生成在线交互式 API 接口文档 -TODO: - -1. [ ] 动态配置:对系统环境进行动态配置(网站标题,LOGO,备案,页脚...) -2. [ ] 代码生成:根据表结构,可视化生成增删改查业务代码 -3. [ ] 文件上传:对接云OSS加本地备份 -4. [ ] 系统通知:主动发送定时任务通知,资源警告,服务异常预警... - ## 本地开发 * Python 3.10+ diff --git a/backend/app/api/v1/mixed/tests.py b/backend/app/api/v1/mixed/tests.py index cb7e0eb1..aacf249d 100644 --- a/backend/app/api/v1/mixed/tests.py +++ b/backend/app/api/v1/mixed/tests.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -from fastapi import APIRouter, File, Form, UploadFile +from fastapi import APIRouter +from backend.app.common.response.response_schema import response_base from backend.app.tasks import task_demo_async router = APIRouter(prefix='/tests') @@ -10,13 +11,10 @@ router = APIRouter(prefix='/tests') @router.post('/send', summary='测试异步任务') async def task_send(): result = task_demo_async.delay() - return {'msg': 'Success', 'data': result.id} + return await response_base.success(data=result.id) -@router.post('/files', summary='测试文件上传') -async def create_file(file: bytes = File(), fileb: UploadFile = File(), token: str = Form()): - return { - 'file_size': len(file), - 'token': token, - 'fileb_content_type': fileb.content_type, - } +@router.post('/send', summary='异步任务演示') +async def send_task(): + result = task_demo_async.delay() + return await response_base.success(data=result.id)