From ee8dd4968191a24fc1dccd56e495139085882b3e Mon Sep 17 00:00:00 2001 From: zjc <1569294420@qq.com> Date: Thu, 6 Feb 2025 00:25:47 -0800 Subject: [PATCH 1/2] feat: add doc --- CONTRIBUTING.md | 65 ++++++++++++++ README.md | 226 ++++++++++++++++++++++++++++++++++++++++++++++++ README.zh-CN.md | 3 +- logo.svg | 44 ++++++++++ 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 logo.svg diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..412db6ac --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,65 @@ +# Contributing +We are glad that you are willing to contribute to the TinyEngine open source project. There are many forms of contribution. You can choose one or more of them based on your strengths and interests: + +* Report new defect. +* Provide more detailed information for the existing defects, such as supplementary screenshots, more detailed reproduction steps, minimum reproducible demo links, etc. +* Submit Pull requests to fix typos in the document or make the document clearer and better. +* Add the official assistant WeChat opentiny-official and join the technical exchange group to participate in the discussion. + +When you personally use the TinyEngine and participate in many of the above contributions, as you become familiar with TinyEngine , you can try to do something more challenging, such as: + +* Fix the defect. You can start with Good-first issue. +* Implementation of new features +* Complete unit tests. +* Translate documents +* Participate in code review. + +### Bug Reports +If you encounter problems when using TinyEngine-backend-java, please submit an issue to us. Before submitting an issue, read the related official documents carefully to check whether the issue is a defect or a function that has not been implemented. + +If the issue is a defect, select the bug report template when creating a new issue. The title must comply with the defect description format. For example, [TinyEngine-backend-java] cannot be refreshed. + +To report a defect, you need to fill in the following information: + +* TinyEngine-backend-java and node version numbers +*Screenshots can be used to describe the defect. If an error is reported, the error information can be posted. +* It is recommended that a minimum demo link be provided to reproduce the defect. + +If the feature is a new feature, select the Feature request template. The title complies with the format of the new feature description, for example, [TinyEngine-backend-java]. + +For an issue of a new feature, you need to fill in the following information: + +* What problems does this feature solve +* What is the API of this feature + +### Pull Requests + +Before submitting pull request, please make sure that your submission is in line with the overall plan of TinyEngine-backend-java. Generally, issues that marked as bug are encouraged to submit pull requests. If you are not sure, you can create a Discussion for discussion. + + +``` +# username indicates the user name. Replace it before running the command. +git clone git@github.com:username/tiny-engine-backend-java.git +cd tiny-engine-backend-java +git remote add upstream git@github.com:opentiny/tiny-engine-backend-java.git + +``` +To submit a PR: + +* Click the Fork button in the upper right corner of the tiny-engine-backend-java repository to fork the upstream repository to your personal repository. +* Clone personal warehouse to local +* Local coding. +* Submit according to Commit Message Format specification. PR that do not conform to the submission specification will not be merged. +* Submit to remote repository: git push origin branchName. +* Open the Pull requests link of the TinyEngine-backend-java code repository and click the New pull request button to submit the PR. +* Project Committer conducts Code Review and makes comments. +* The PR author adjusts the code according to the opinion. Please note that when a branch initiates PR, the subsequent commit will be synchronized automatically, and there is no need to resubmit the PR. +* Project administrator merges PR. + +The contribution process is over, thank you for your contribution! + +### Join the open source community +If you are interested in our open source projects, please join our open source community in the following ways. + +* Add the official assistant WeChat: opentiny-official, join our technical exchange group +* Join the mailing list: opentiny@googlegroups.com \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..9b9b8f69 --- /dev/null +++ b/README.md @@ -0,0 +1,226 @@ +

+ + OpenTiny Logo + +

+

Tiny Engine Web Service is a RESTful API responsible for providing data services, code generation services, and code release services to the front end. It does not directly operate on the database, and data operations request interfaces from TinyEngine Data Center.

+ + +English | [简体中文](README.zh-CN.md) + +Local Boot Steps: +* Click the Fork button in the upper right corner of the tiny-engine-backend-java repository to fork the upstream repository to your personal repository +* Clone personal warehouse to local +* The installation depends on JDK 1.8 and Maven 3.5 or later +* Modify the configuration of the connection database in the tiny-engine-backend-java/app/src/main/resources/application-dev.yml file +* Start the project in tiny-engine-backend-java/app/src/main/java/com/tinyengine/it/TinyEngineApplication for local development + +For details, see the section on how to start a local front-end and backend in [TinyEngine Official Website - User Manual](https://opentiny.design/tiny-engine#/help-center/course/backend/51). + +### Directory Rules + +Before development, you need to understand the overall directory structure of the project and compile code according to the following rules + +``` +├── README.md +├── app // Basic services +│ └── src +│ └── main +│ └── java +│ ├── com.tinyengine.it +│ │ ├── config // Profiles +│ │ └── TinyEngineApplication // Startup class, main entrance +│ └── resource +│ ├── sql // SQL files, including table creation files and SQL files of basic data +│ │ ├── h2 +│ │ ├──mysql +│ │ └──postgresql +│ └── application.yml +│ +│ // Configuration information, some of the configurations that are mainly used to manage the Springboot application globally, some configurations related to MybatisPlus, etc +└── base // Business function services + └── src + ├── main + │ └── java + │ └── com + │ └── tinyengine + │ └── it + │ ├── common // Public Documents + │ │ ├── base // Public entity classes + │ │ │ └── BaseEntity + │ │ ├── enums // Public enumeration classes + │ │ │ └── Enums + │ │ ├── exception // Public anomaly classes + │ │ │ └── ExceptionEnum + │ │ ├── handler // Data type processor + │ │ │ └── ListTypeHandler + │ │ ├── log // System logs + │ │ │ └── SystemControllerLog + │ │ └── utils // Utilities + │ │ └── Utils + │ ├── config // Configure the class + │ │ └── AiChatConfig + │ ├── controller // Business control layer + │ │ └── AppController + │ ├── gateway // gateway + │ │ └── ai + │ │ └── AiChatClient + │ ├── mapper // Data access layer + │ │ └── AppMapper + │ ├── model // Model entity class + │ │ ├── dto + │ │ │ └── BlockDto + │ │ └── entity + │ │ └── Block + │ └── service // Business logic layer + │ ├── app // app module + │ │ ├── impl // APP module business implementation class + │ │ │ └── AppServiceImpl + │ │ └── AppService // Business logic interface of the app module + │ ├── material // Material module + │ │ ├── impl // The business implementation class of the material module + │ │ │ └── BlockServiceImpl + │ │ └── BlockService // Taking blocks as an example, this layer is the business logic interface related to the material + │ └── platform // Designer module + │ ├── impl // The business implementation class of the designer module + │ │ └── PlatformServiceImpl + │ └── PlatformService // The business logic interface of the designer module + └── test // The test directory is divided into test cases of different modules according to the above directory + ├── java + │ └── com + │ └── tinyengine + │ └── it + │ ├── common + │ │ ├── base + │ │ │ └── ResultTest + │ │ ├── exception + │ │ │ └── GlobalExceptionAdviceTest + │ │ ├── handler + │ │ │ └── ListTypeHandlerTest + │ │ ├── log + │ │ │ └── SystemLogAspectTest + │ │ └── utils + │ │ └── UtilsTest + │ ├── controller + │ │ └── AppControllerTest + │ ├── gateway + │ │ └── ai + │ │ └── AiChatClientTest + │ ├── mapper + │ │ └── AppMapperTest + │ └── service + │ ├── app + │ │ └── impl + │ │ └── AppServiceImplTest + │ ├── material + │ │ └── impl + │ │ └── BlockServiceImplTest + │ └── platform + │ └── impl + │ └── PlatformServiceImplTest + └── resources +``` + + +### Interface Return Specifications + +##### 1.Return Format + +- Correct data +```java +{ + "data": { + "id": 1, + "createdBy": "1" + } + "code": "200", + "message": "操作成功", + "error": null, + "errMsg": null, + "success": true + } +``` +- Error Data +```java +{ + "data": null, + "code": "CM003", + "message": "重复创建,请修改传入参数。", + "error": { + "code": "CM003", + "message": "重复创建,请修改传入参数。" + }, + "errMsg": "重复创建,请修改传入参数。", + "success": false + } +``` + +### Manual + +For more information about how to use the server, please refer to [TinyEngine Official Website - User Manual](https://opentiny.design/tiny-engine#/help-center/course/backend/51) + + +#### Local Runtime Configuration: + +JDK1.8, +Maven 3.5 or later is sufficient, +mysql 8 + +### Database table mapping before and after data migration + +- Blocks -------> historical association changes in blocks: + After being refactored by the blocks__histories of nodejs, ref_id the block table associated with this property is directly added to the t_block_history table of the Java database, and there is no need to blocks__histories the associated table + +- Material -------> block association changes: + The block-history_id field in the material block history relationship table of the block_histories_materials__materials_user_blocks of nodejs is used to find the primary key of the block in the block_id block_histories table, and then the block information is found in the block table through the block_id, in order to query more conveniently. In the Java database table, the relationship table between blocks and materials is directly created r_material_block + +***Summarizing the changes in the database table can be roughly divided into the following types*** + +- The definition of the field in the database table is more standardized, and the previous hump is changed to an underscore name, such as isDefault -> is_default +- The meaning of the definition of the database table field is clearer, such as app -> app_id, created_at -> created_time +- Most of the database tables have new tenant_id, site_id, renter_id, and platform_id fields, as well as designer tables t_platform and designer history tables t_platform_history due to tenant isolation +- The database table relationship is clearer and clearer, and some useless table relationships are deleted, such as the table relationship between the block and the block history, which is directly t_block_history added to the block history table, that is, the ref_id as a foreign key +- The block_categories block classification was deleted, and the block grouping and classification were merged into a block grouping, taking into account the similar functions and functions of grouping and classification +- The t_business_category of the business classification table and the relationship table between the material and the business classification are reserved, and r_material_category + + +| nodejs数据库表 | java数据库表 | 新增属性 | 删除属性 | 修改属性 | +| :----- |:----------------------------:|:----------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| app_extensions | t_app_extension | tenant_id、site_id、renter_id | | app -> app_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time、 | +| apps | t_app | site_id、renter_id | tpl-groups、created_by、updated_by | platform -> platform_id、platform_history -> platform_history_id、 obs_url -> publish_url、home_page -> home_page_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、 created_at -> created_time、 updated_at -> last_updated_time | +| block_groups | t_block_group | platform_id、tenant_id、site_id、renter_id | | app -> app_id、 dec -> description、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| block_histories | t_block_history | framework、 tags、is_official、 public、is_default、tiny_reserved、platform_id、block_group_id | | created_app -> app_id、block_id -> ref_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time、 | +| blocks | t_block | latest_version、 i18n | created_by、updated_by、author、 | name_cn -> name、current_history -> latest_history_id、occupier -> occupier_by、isOfficial -> is_official、isDefault -> is_default、createdBy -> created_by、updatedBy -> last_updated_by、 created_at -> created_time、 updated_at -> last_updated_time | +| blocks_groups__block_groups_blocks | r_block_group_block | | |block-group_id -> block_group_id、 | +|blocks_carriers_relations|t_block_carriers_relation|tenant_id、site_id、renter_id| |block -> block_id、 host ->host_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time | +| block_histories_material_histories__material_histories_blocks | r_material_history_block | | | material-history_id -> material_history_id、 block-history_id -> block_history_id | +| material_histories | t_material_history | image_url、build_info、tgz_url、 material_size、site_id、renter_id | | material -> ref_id、 tenant -> tenant_id 、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| material_histories_components__user_components_mhs | r_material_history_component | | | material-history_id -> material_history_id、 user-component_id -> component_id | +| materials | t_material | material_category_id、material_size、tgz_url、unzip_tgz_root_path_url、unzip_tgz_files、tenant_id、site_id、renter_id | name_cn、user_components、latest | version -> latest_version、material_histories -> latest_history_id、isOfficial -> is_official、isDefault ->is_default、component_library -> component_library_id、 | +| materials_user_components__user_components_materials | r_material_component | | | user-component_id -> component_id | +| pages | t_page | latest_version、latest_history_id、tenant_id、site_id、renter_id| created_by、updated_by | app -> app_id、occupier -> occupier_by、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| pages_histories | t_page_history | ref_id、version、app_id、depth、is_page、is_default、is_published、tenant_id、site_id、renter_id| time | updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| templates | t_page_template |name、status、is_preset、image_url、tenant_id、site_id、renter_id、platform_id、 | name_en、name_cn、thumbnail、tags、created_app、create_app、created_by、updated_by |content ->page_content、tpl_type ->type、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| i18n_entries | t_i18n_entry | tenant_id、site_id、renter_id | | host -> host_id、lang -> lang_id、 updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| i18n_langs | t_i18n_lang | | | updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| sources | t_datasource | platform_id、tenant_id、site_id、renter_id| | app -> app_id、desc -> description、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| task_record | t_task_record | build_id、tenant_id、site_id、renter_id| uniqueId、created_by、updated_by | teamId ->team_id、taskTypeId ->task_type、taskName ->task_name、taskStatus ->task_status、taskResult ->task_result、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| user_components | t_component |name_en、tenant_id、site_id、renter_id | component | isOfficial ->is_official、isDefault -> is_default、library -> library_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| users-permissions_user | t_user |enable、tenant_id、site_id、renter_id | provider、password、resetPasswordToken、confirmationToken、confirmed、blocked | updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| tenants | t_tenant | | created_by、updated_by | tenant_id -> org_code、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| platforms | t_platform| latest_history_id、site_id、renter_id | is_java、created_by、updated_by | theme -> theme_id、latest -> latest_version、material_history -> material_history_id、business_category -> business_category_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、updated_at -> last_updated_time | +|platform_histories|t_platform_history|publish_url、image_url、tenant_id、site_id、renter_id | |platform -> ref_id、material_history -> material_history_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time | + + +### 🤝 Participating in contributions Q + +If you are interested in our open source project, please join us! + +Please read [the Contribution Guide](CONTRIBUTING.md) before participating in the contribution. + +- Add official assistant WeChat opentiny-official and join the technical exchange group +- Join the mailing list opentiny@googlegroups.com + +### Open source protocol + +[MIT](LICENSE) diff --git a/README.zh-CN.md b/README.zh-CN.md index bbf7ce7e..0f72a205 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -197,7 +197,6 @@ mysql 8 | blocks_groups__block_groups_blocks | r_block_group_block | | |block-group_id -> block_group_id、 | |blocks_carriers_relations|t_block_carriers_relation|tenant_id、site_id、renter_id| |block -> block_id、 host ->host_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time | | block_histories_material_histories__material_histories_blocks | r_material_history_block | | | material-history_id -> material_history_id、 block-history_id -> block_history_id | -| i18n_langs | t_i18n_lang | | | updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | | material_histories | t_material_history | image_url、build_info、tgz_url、 material_size、site_id、renter_id | | material -> ref_id、 tenant -> tenant_id 、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | | material_histories_components__user_components_mhs | r_material_history_component | | | material-history_id -> material_history_id、 user-component_id -> component_id | | materials | t_material | material_category_id、material_size、tgz_url、unzip_tgz_root_path_url、unzip_tgz_files、tenant_id、site_id、renter_id | name_cn、user_components、latest | version -> latest_version、material_histories -> latest_history_id、isOfficial -> is_official、isDefault ->is_default、component_library -> component_library_id、 | @@ -212,6 +211,8 @@ mysql 8 | user_components | t_component |name_en、tenant_id、site_id、renter_id | component | isOfficial ->is_official、isDefault -> is_default、library -> library_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | | users-permissions_user | t_user |enable、tenant_id、site_id、renter_id | provider、password、resetPasswordToken、confirmationToken、confirmed、blocked | updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | | tenants | t_tenant | | created_by、updated_by | tenant_id -> org_code、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time | +| platforms | t_platform| latest_history_id、site_id、renter_id | is_java、created_by、updated_by | theme -> theme_id、latest -> latest_version、material_history -> material_history_id、business_category -> business_category_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、updated_at -> last_updated_time | +|platform_histories|t_platform_history|publish_url、image_url、tenant_id、site_id、renter_id | |platform -> ref_id、material_history -> material_history_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time | ### 🤝 参与贡献 diff --git a/logo.svg b/logo.svg new file mode 100644 index 00000000..4332c518 --- /dev/null +++ b/logo.svg @@ -0,0 +1,44 @@ +README.md + + logo-top + + + + + + + + + + + + + + + + + + + + + + + + + + + + OpenTiny + + + + + + + + + + + + + \ No newline at end of file From 98f8f6ac55e746ac710a496515d528ef1ad23aff Mon Sep 17 00:00:00 2001 From: zjc <1569294420@qq.com> Date: Thu, 6 Feb 2025 00:29:45 -0800 Subject: [PATCH 2/2] modify doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b9b8f69..23dca2a6 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ mysql 8 - The t_business_category of the business classification table and the relationship table between the material and the business classification are reserved, and r_material_category -| nodejs数据库表 | java数据库表 | 新增属性 | 删除属性 | 修改属性 | +| nodejs database tables | Java database tables | New attributes | Delete the attribute | Modify the attributes | | :----- |:----------------------------:|:----------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | app_extensions | t_app_extension | tenant_id、site_id、renter_id | | app -> app_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time、 | | apps | t_app | site_id、renter_id | tpl-groups、created_by、updated_by | platform -> platform_id、platform_history -> platform_history_id、 obs_url -> publish_url、home_page -> home_page_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、 created_at -> created_time、 updated_at -> last_updated_time |