Files
cadannotation/README.md

59 lines
1.7 KiB
Markdown

# CadLabel Backend
Spring Boot backend skeleton for CadLabel.
## Stack
- Java 21
- Spring Boot 3.4.4
- Maven
- MyBatis-Plus
- MySQL
- Tencent Cloud COS SDK
This project intentionally does not include Spring Security, JWT, login APIs, or user-system code.
## Run
```bash
mvn test
mvn spring-boot:run
```
The default profile is `dev`. Configure these environment variables before starting against a real database and COS bucket:
```bash
export APP_DB_URL='jdbc:mysql://localhost:3306/cadlabel?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&createDatabaseIfNotExist=true'
export APP_DB_USERNAME='root'
export APP_DB_PASSWORD=''
export APP_COS_SECRET_ID=''
export APP_COS_SECRET_KEY=''
export APP_COS_BUCKET=''
export APP_COS_REGION='ap-beijing'
export APP_COS_PUBLIC_BASE_URL=''
```
## COS APIs
- `POST /api/cos/upload-sessions` issues temporary STS credentials for direct browser upload.
- `POST /api/cos/objects` accepts multipart file upload and stores the file through the backend.
Both endpoints return the standard `ApiResponse<T>` shape.
## Replace The Annotation Dataset
The import runner accepts only `solidworks.rebuild_extract.v1` JSON files. It clears existing
models, histories, annotations, structures, functions, and their relations before importing the
new dataset. It is disabled by default and should run as a non-web process:
```bash
APP_JSON_DATASET_IMPORT_ENABLED=true \
APP_JSON_DATASET_IMPORT_SOURCE_DIRECTORY='/absolute/path/to/output_json 2' \
APP_JSON_DATASET_IMPORT_CATEGORY_ID=1 \
mvn spring-boot:run -Dspring-boot.run.arguments=--spring.main.web-application-type=none
```
The source files contain feature trees only. The importer creates annotation histories but does
not fabricate STEP, GLB, or topology assets.