diff --git a/be/app/api/v1/files.py b/be/app/api/v1/files.py index 9231704..c548c0c 100644 --- a/be/app/api/v1/files.py +++ b/be/app/api/v1/files.py @@ -66,7 +66,7 @@ def query_file(): def get_json(): ret_info = ReturnInfo() try: - + project_name = request.args.get("projectName") download_json = [] anno_data = read_json_file(PROJECT_PATH.format(project_name)+'/anno.json') diff --git a/be/app/api/v1/project.py b/be/app/api/v1/project.py index 8108f6c..86f91de 100644 --- a/be/app/api/v1/project.py +++ b/be/app/api/v1/project.py @@ -16,7 +16,21 @@ from ...entities.entities import AnnoContents api = RedPrint('project') +@api.route('/delete_program', methods=['GET']) +def delete_program(): + ret_info = ReturnInfo() + try: + project_name = request.args.get('projectName') + project_path = PROJECT_PATH.format(project_name) + shutil.rmtree(project_path) + print("ok") + except Exception as e: + print(e) + ret_info.errCode = 404 + ret_info.errMsg = str(e) + + return json.dumps(ret_info, default=lambda o: o.__dict__) @api.route('/get_zipped_data', methods=['POST']) def get_zipped_data(): ret_info = ReturnInfo() diff --git a/be/app/projects/test/anno.json b/be/app/projects/test/anno.json index f47fb6b..77ac6e3 100644 --- a/be/app/projects/test/anno.json +++ b/be/app/projects/test/anno.json @@ -1 +1 @@ -[{"fileName": "first.txt", "annoDetails": [{"name": "是一个测", "type": "test1", "start": 1, "end": 5, "isSmall": false}, {"name": "测", "type": "test2", "start": 4, "end": 5, "isSmall": true}, {"name": "文", "type": "test2", "start": 6, "end": 7}], "isAnno": true}] \ No newline at end of file +[{"fileName": "first.txt", "annoDetails": [{"name": "是一个测", "type": "test1", "start": 1, "end": 5, "isSmall": false}, {"name": "测", "type": "test2", "start": 4, "end": 5, "isSmall": true}, {"name": "文", "type": "test2", "start": 6, "end": 7}], "isAnno": true}, {"fileName": "second.txt", "annoDetails": [{"name": "点亮", "type": "test1", "start": 2, "end": 4}], "isAnno": true}, {"fileName": "test.txt", "annoDetails": [{"name": "一种信", "type": "test1", "start": 3, "end": 6}], "isAnno": true}, {"fileName": "txt.txt", "annoDetails": [{"name": "试文件", "type": "test1", "start": 5, "end": 8}], "isAnno": true}] \ No newline at end of file diff --git a/be/app/projects/test/新建文本文档 - 副本 (2).txt b/be/app/projects/test/新建文本文档 - 副本 (2).txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档 - 副本 (2).txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/be/app/projects/test/新建文本文档 - 副本 (3).txt b/be/app/projects/test/新建文本文档 - 副本 (3).txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档 - 副本 (3).txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/be/app/projects/test/新建文本文档 - 副本 (4).txt b/be/app/projects/test/新建文本文档 - 副本 (4).txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档 - 副本 (4).txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/be/app/projects/test/新建文本文档 - 副本 (5).txt b/be/app/projects/test/新建文本文档 - 副本 (5).txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档 - 副本 (5).txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/be/app/projects/test/新建文本文档 - 副本.txt b/be/app/projects/test/新建文本文档 - 副本.txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档 - 副本.txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/be/app/projects/test/新建文本文档.txt b/be/app/projects/test/新建文本文档.txt new file mode 100644 index 0000000..e7bccfb --- /dev/null +++ b/be/app/projects/test/新建文本文档.txt @@ -0,0 +1 @@ +这是一个新增文件 diff --git a/doc/api.md b/doc/api.md index 251fa49..82afc64 100644 --- a/doc/api.md +++ b/doc/api.md @@ -4,4 +4,5 @@ | -------------------------- | ------- | -------------------------------------------------------- | -------------------------------- | | v1/project/get_zipped_data | POST | projectName:项目名 file:数据集文件(目前只支持.zip格式) | json :errcode表示是否成功导入 | | v1/files/get_json | GET | projectName:项目名 | file(.json格式的数据集标注结果) | +|v1/project/delete_program |GET |projectName:项目名|json:errcode表示是否成功|