Skip to content

Commit

Permalink
[feat] HertzBeat Official Template Marketplace [apache#1792]
Browse files Browse the repository at this point in the history
  • Loading branch information
All-The-Best-for committed Oct 19, 2024
1 parent 24595fb commit 76bb28c
Show file tree
Hide file tree
Showing 94 changed files with 5,813 additions and 708 deletions.
37 changes: 27 additions & 10 deletions template-marketplace/hertzbeat-template-hub/apiTest/category.http
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
### add category
POST http://localhost:8080/api/category/upload/test
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### add categoryDO
POST http://localhost:8080/api/categoryDO/upload/test
Content-Type: application/x-www-form-urlencoded

description=test

### modify category
POST http://localhost:8080/api/category/modify/1
### modify categoryDO
POST http://localhost:8080/api/categoryDO/modify/1
Content-Type: application/x-www-form-urlencoded

name=Database monitoring&
description=数据库监控模版

### delete category
DELETE http://localhost:8080/api/category/delete/1
### delete categoryDO
DELETE http://localhost:8080/api/categoryDO/delete/1

### get category by isDel
GET http://localhost:8080/api/category/all/0
### get categoryDO by isDel
GET http://localhost:8080/api/categoryDO/all/0

### get category page by isDel
GET http://localhost:8080/api/category/page/isDel/0?page=0&size=2
### get categoryDO page by isDel
GET http://localhost:8080/api/categoryDO/page/isDel/0?page=0&size=2
21 changes: 19 additions & 2 deletions template-marketplace/hertzbeat-template-hub/apiTest/share.http
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### share
GET http://localhost:8080/api/share/getShareURL/100
GET http://localhost:8080/api/share/getShareURL/1

### downloadShare
GET http://localhost:8080/api/share/share/6laZF
GET http://localhost:8080/api/share/download/6laZF
43 changes: 31 additions & 12 deletions template-marketplace/hertzbeat-template-hub/apiTest/star.http
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
### star version
POST http://localhost:8080/api/version/star
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### get starDO templateDO id by user
GET http://localhost:8080/api/starDO/1

### assert templateDO is starDO by user
GET http://localhost:8080/api/starDO/isStar/1/1

### starDO versionDO
POST http://localhost:8080/api/templateDO/starDO
Content-Type: application/x-www-form-urlencoded

user=1&
template=1&
version=1

### get star version by user
GET http://localhost:8080/api/star/1
templateDO=3

### get star version page by user
GET http://localhost:8080/api/star/page/user/1?page=0&size=2
### get starDO templateDO page by user
GET http://localhost:8080/api/starDO/page/user/1?page=0&size=10

### cancel star
POST http://localhost:8080/api/star/cancel/1
### cancel starDO
POST http://localhost:8080/api/starDO/cancel/1
Content-Type: application/x-www-form-urlencoded

versionId = 1
templateId = 1

41 changes: 27 additions & 14 deletions template-marketplace/hertzbeat-template-hub/apiTest/template.http
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### Get templates By user
GET http://localhost:8080/api/template/1

### Get templates Page By user
GET http://localhost:8080/api/template/page/user/1?page=0&size=2
GET http://localhost:8080/api/template/page/user/1?page=0&size=10

### Get templates By category
GET http://localhost:8080/api/template/category/1

### Get templates Page By category
GET http://localhost:8080/api/template/page/category/1_3/0/1?page=0&size=2

### Get templates By namelike
GET http://localhost:8080/api/template/name/My
GET http://localhost:8080/api/template/page/category/1_3/0/1/1?page=0&size=2

### Get templates Page By namelike
GET http://localhost:8080/api/template/page/name/My/0/1?page=0&size=2
### Get templates Page
GET http://localhost:8080/api/template/page/0/1?page=0&size=10

### Get templates order by order
GET http://localhost:8080/api/template/query/3/0

### Get templates Page order by order
GET http://localhost:8080/api/template/page/order/3/0?page=0&size=2

### Get templates Page By option
GET http://localhost:8080/api/template/page/option/My/1_3/0/1?page=0&size=2
GET http://localhost:8080/api/template/page/option/My/1_3/0/1/1?page=0&size=10

### Get all templates
GET http://localhost:8080/api/template
GET http://localhost:8080/api/template/
Content-Type: application/json

### Get all templates Page
GET http://localhost:8080/api/template/page/0?page=0&size=2
{
"Token": "eyJhbGciOiJIUzUxMiIsInppcCI6IkRFRiJ9.eJwty0EKwjAQheG7zLqRZDpNbFfeQ0QmccSIsaVJVRDvbiruHh_vf8O1RBjAG0fhzEb15EiRR6u2QViJZ20MomMSaCAvvp6fPqNG2hnbbsKYqsecq5cxKV7KRWWZHzKvzgUG47BvyVrbNSCv6Q-dxhXm8Sa13f_GkU8p3uHw-QJ8uCs1.S7g0Z5z3xRySt_xCn8jugaMUwBO56aAZMr-tYGhoskM0hcdkG91WrEF-gAF43r_Ue3V_LGKKyGZrUUpOXeHJIA"
}

### download
GET http://localhost:8080/api/template/download/1/1/v1.0.0/1
Expand Down
47 changes: 46 additions & 1 deletion template-marketplace/hertzbeat-template-hub/apiTest/user.http
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
###
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### Registy
POST http://localhost:8080/api/auth/register
Content-Type: application/json

{
"type": 1,
"identifier": "[email protected]",
"credential": "123456"
}

### Login
POST http://localhost:8080/api/auth/token
Content-Type: application/json

{
"type": 1,
"identifier": "[email protected]",
"credential": "123456"
}

### custom token
POST http://localhost:8080/api/auth/custom/token
Content-Type: application/json

{
"type": 1,
"identifier": "[email protected]",
"credential": "123456"
}
29 changes: 23 additions & 6 deletions template-marketplace/hertzbeat-template-hub/apiTest/version.http
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
### Get all version information of a template
GET http://localhost:8080/api/version/version/1
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

### Get all version page of a template
GET http://localhost:8080/api/version/page/1/0?page=0&size=2
### Get all versionDO information of a templateDO
GET http://localhost:8080/api/versionDO/versionDO/1

### Get version information By ID
GET http://localhost:8080/api/version/get/1
### Get all versionDO page of a templateDO
GET http://localhost:8080/api/versionDO/page/1/0?page=0&size=2

### Get versionDO information By ID
GET http://localhost:8080/api/versionDO/get/1
18 changes: 18 additions & 0 deletions template-marketplace/hertzbeat-template-hub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<mybatis-plus-boot-starter.version>3.5.7</mybatis-plus-boot-starter.version>
<minio.version>8.4.3</minio.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<spring-boot-starter-sureness.version>1.1.0</spring-boot-starter-sureness.version>
</properties>
<dependencies>

Expand Down Expand Up @@ -149,6 +150,23 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<dependency>
<groupId>com.usthe.sureness</groupId>
<artifactId>sureness-core</artifactId>
<version>1.1.0</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@ServletComponentScan(basePackages = "org.apache.hertzbeat.templatehub.sureness")
@SpringBootApplication
@EnableTransactionManagement
public class HertzbeatTemplateHubApplication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public class FileStorageConfig {
@Value("${minio.secretKey}")
private String secretKey;

private String getStorageType(){
return this.storageType;
}

@Bean
public FileStorageService fileStorageService() {
if ("minio".equalsIgnoreCase(storageType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public interface CommonConstants {
*/
byte FAIL_CODE = 0x0F;

/**
* Response status code: Incorrect login account password
*/
byte LOGIN_FAILED_CODE = 0x06;

/**
* Response status code: Parameter verification failed
*/
Expand Down
Loading

0 comments on commit 76bb28c

Please sign in to comment.