klesh commented on code in PR #308:
URL:
https://github.com/apache/incubator-devlake-website/pull/308#discussion_r1011469850
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
Review Comment:
`project_metrics` describes what metrics a project had enabled.
"both side of the mapping" doesn't sound right, it feels like you are
talking about `project_mapping`, please remove this part to avoid confusion.
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
Review Comment:
should return the `project_metrics` and `project_mapping` information for
the project as well
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
+
+3. 在上述过程之后 通过 `POST` `/project_metrics` 接口来创建一组 `project` 与 `plugins`
之间的关系。使用我们前面获取到的 `project_name` 和 `plugin_name` 来构建这种关系。同时为其配置相应的 `option`.
Review Comment:
I think a better way is to accept `project_metrics` and `project_mapping` in
`POST /projects` and `PATCH /projects/:projectId` endpoint, so that users may
create them in one request. which makes more sense to me. @mintsweet what do
you think?
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
Review Comment:
`PATCH /projects/:projectId`
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
+
+3. 在上述过程之后 通过 `POST` `/project_metrics` 接口来创建一组 `project` 与 `plugins`
之间的关系。使用我们前面获取到的 `project_name` 和 `plugin_name` 来构建这种关系。同时为其配置相应的 `option`.
+
+当我们创建出一组 `project_metrics` 的关系后我们就可以做更进一步的操作:
+
+- 我们可以通过 `GET` `/project_metrics` 接口来获取一组 `project_metrics` 信息,我们可以只设置
`project_name` 或只设置 `plugin_name` 来进行筛选。也可以同时设置 `project_name` 和 `plugin_name`
此时我们将获取到一个特定的 `project_metrics` 信息。
+- 我们可以通过 `UPDATE` `/project_metrics` 接口来更新特定的一组 `project_metrics`
信息。这要求我们必须同时设置好 `project_name` 和 `plugin_name`。
+
+# 关于 Project 和 Blueprint
+
+- 在 `blueprint` 的表中现在添加了一个与 `project` 相关联的字段 `project_name`,该字段表示 当前的
`blueprint` 唯一的属于某一张特定的 `project`
+- 一个`project`允许被多个 `blueprint` 的 `project_name`
字段指定。也就是`project`对`blueprint`是一对多关系
+- 可以通过以下sql 快速的查看 某个 `project` 所对应的全部 `blueprint`
+
+```
+SELECT * from `_devlake_blueprints` where `project_name`="ProjectName";
+```
+
+
+## The PluginMetric Interface
+
+
+```go
+type PluginMetric interface {
+ // returns a list of required data entities and expected features.
+ // [{ "model": "cicd_tasks", "requiredFields": {"column": "type",
"execptedValue": "Deployment"}}, ...]
+ RequiredDataEntities() (data map[string]interface{},err errors.Error)
+
+ // This method returns all models of the current plugin
+ GetTablesInfo() []core.Tabler
+
+ // returns if the metric depends on Project for calculation.
+ // Currently, only dora would return true.
+ IsProjectMetric() bool
+
+ // indicates which plugins must be executed before executing this one.
+ // declare a set of dependencies with this
+ RunAfter() (PluginsNames []string,errors.Error)
+
+ // returns an empty pointer of the plugin setting struct.
+ // (no concrete usage at this point)
+ Settings() (p interface{})
+}
+```
+
+## models
Review Comment:
I don't think we need this part.
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
Review Comment:
and it should be `/projects`, plural
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
Review Comment:
Please join the METHOD and URL, no need to separate them.
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
Review Comment:
it doesn't seem right, we had this table already, it should contains
`project_name` `table` and `row_id`
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
+
+3. 在上述过程之后 通过 `POST` `/project_metrics` 接口来创建一组 `project` 与 `plugins`
之间的关系。使用我们前面获取到的 `project_name` 和 `plugin_name` 来构建这种关系。同时为其配置相应的 `option`.
+
+当我们创建出一组 `project_metrics` 的关系后我们就可以做更进一步的操作:
+
+- 我们可以通过 `GET` `/project_metrics` 接口来获取一组 `project_metrics` 信息,我们可以只设置
`project_name` 或只设置 `plugin_name` 来进行筛选。也可以同时设置 `project_name` 和 `plugin_name`
此时我们将获取到一个特定的 `project_metrics` 信息。
+- 我们可以通过 `UPDATE` `/project_metrics` 接口来更新特定的一组 `project_metrics`
信息。这要求我们必须同时设置好 `project_name` 和 `plugin_name`。
+
+# 关于 Project 和 Blueprint
+
+- 在 `blueprint` 的表中现在添加了一个与 `project` 相关联的字段 `project_name`,该字段表示 当前的
`blueprint` 唯一的属于某一张特定的 `project`
+- 一个`project`允许被多个 `blueprint` 的 `project_name`
字段指定。也就是`project`对`blueprint`是一对多关系
+- 可以通过以下sql 快速的查看 某个 `project` 所对应的全部 `blueprint`
Review Comment:
no need to mention this
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
Review Comment:
and i think we should add a new item `project_mapping`
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
+
+3. 在上述过程之后 通过 `POST` `/project_metrics` 接口来创建一组 `project` 与 `plugins`
之间的关系。使用我们前面获取到的 `project_name` 和 `plugin_name` 来构建这种关系。同时为其配置相应的 `option`.
+
+当我们创建出一组 `project_metrics` 的关系后我们就可以做更进一步的操作:
+
+- 我们可以通过 `GET` `/project_metrics` 接口来获取一组 `project_metrics` 信息,我们可以只设置
`project_name` 或只设置 `plugin_name` 来进行筛选。也可以同时设置 `project_name` 和 `plugin_name`
此时我们将获取到一个特定的 `project_metrics` 信息。
+- 我们可以通过 `UPDATE` `/project_metrics` 接口来更新特定的一组 `project_metrics`
信息。这要求我们必须同时设置好 `project_name` 和 `plugin_name`。
+
+# 关于 Project 和 Blueprint
+
+- 在 `blueprint` 的表中现在添加了一个与 `project` 相关联的字段 `project_name`,该字段表示 当前的
`blueprint` 唯一的属于某一张特定的 `project`
+- 一个`project`允许被多个 `blueprint` 的 `project_name`
字段指定。也就是`project`对`blueprint`是一对多关系
Review Comment:
no, it should be 1:1 relationship.
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
+
+3. 在上述过程之后 通过 `POST` `/project_metrics` 接口来创建一组 `project` 与 `plugins`
之间的关系。使用我们前面获取到的 `project_name` 和 `plugin_name` 来构建这种关系。同时为其配置相应的 `option`.
+
+当我们创建出一组 `project_metrics` 的关系后我们就可以做更进一步的操作:
+
+- 我们可以通过 `GET` `/project_metrics` 接口来获取一组 `project_metrics` 信息,我们可以只设置
`project_name` 或只设置 `plugin_name` 来进行筛选。也可以同时设置 `project_name` 和 `plugin_name`
此时我们将获取到一个特定的 `project_metrics` 信息。
+- 我们可以通过 `UPDATE` `/project_metrics` 接口来更新特定的一组 `project_metrics`
信息。这要求我们必须同时设置好 `project_name` 和 `plugin_name`。
+
+# 关于 Project 和 Blueprint
+
+- 在 `blueprint` 的表中现在添加了一个与 `project` 相关联的字段 `project_name`,该字段表示 当前的
`blueprint` 唯一的属于某一张特定的 `project`
+- 一个`project`允许被多个 `blueprint` 的 `project_name`
字段指定。也就是`project`对`blueprint`是一对多关系
+- 可以通过以下sql 快速的查看 某个 `project` 所对应的全部 `blueprint`
+
+```
+SELECT * from `_devlake_blueprints` where `project_name`="ProjectName";
+```
+
+
+## The PluginMetric Interface
+
+
+```go
+type PluginMetric interface {
+ // returns a list of required data entities and expected features.
+ // [{ "model": "cicd_tasks", "requiredFields": {"column": "type",
"execptedValue": "Deployment"}}, ...]
+ RequiredDataEntities() (data map[string]interface{},err errors.Error)
+
+ // This method returns all models of the current plugin
+ GetTablesInfo() []core.Tabler
+
+ // returns if the metric depends on Project for calculation.
+ // Currently, only dora would return true.
+ IsProjectMetric() bool
+
+ // indicates which plugins must be executed before executing this one.
+ // declare a set of dependencies with this
+ RunAfter() (PluginsNames []string,errors.Error)
+
+ // returns an empty pointer of the plugin setting struct.
+ // (no concrete usage at this point)
+ Settings() (p interface{})
+}
+```
+
+## models
+
+The following is the table structure data of `project` related.
+
+```go
+type Projects struct {
+ Name string `gorm:"primaryKey" gorm:"type:varchar(255)"`
+ describe string `gorm:"type:text"`
+ CreatedAt time.time
+ UpdatedAt time.time
+}
+
+func (Projects) TableName() {
+ return "_devlake_projects"
+}
+
+type ProjectMetrics struct {
+ ProjectName string `gorm:"primaryKey" gorm:"type:varchar(255)"`
+ PluginName string `gorm:"primaryKey" gorm:"type:varchar(255)"`
+ PluginOption string `gorm:"type:text"`
+}
+
+func (ProjectMetrics) TableName() {
+ return "_devlake_project_metrics"
+}
+
+type ProjectMetrics struct {
+ ProjectName string `gorm:"primaryKey" gorm:"type:varchar(255)"`
+ PluginName string `gorm:"primaryKey" gorm:"type:varchar(255)"`
+ PluginOption string `gorm:"type:text"`
+}
+
+type ProjectMapping struct {
+ ProjectName string `gorm:"primaryKey;type:varchar(255)"`
+ ScopeID string `gorm:"primaryKey;type:varchar(255)"`
+}
+
+func (ProjectMapping) TableName() string {
+ return "_devlake_project_mapping"
+}
+
+```
+
+## api
Review Comment:
no need to put it here, api doc should be rendered in swag doc.
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
Review Comment:
should support `search` and `pagination` as well
##########
docs/DeveloperManuals/Project.md:
##########
@@ -0,0 +1,226 @@
+---
+title: "Project"
+sidebar_position: 5
+description: >
+ `Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+---
+
+## Summary
+`Project` is **a set of scopes from different domains**, a way to group
different resources, and it is crucial for some metric calculation like `DORA`.
+
+It contains the following two models:
+ - `projects` describes a project object, including its name, creation and
update time and other basic information
+ - `project_metrics` describes the mapping relationship enabled by a plugin,
including the name of the project and plugin on both sides of the mapping, and
basic information about plugin options.
+
+
+
+## projects
+
+| **field** | **type** | **length** | **description** |
**key** |
+| ------------- | -------- | ---------- | ----------------------------- |
------- |
+| `name` | varchar | 255 | name for project | PK
|
+| `description` | longtext | | description of the project |
|
+| `created_at` | datetime | 3 | created time of project |
|
+| `updated_at` | datetime | 3 | last updated time of project |
|
+
+
+| **name** | **describe** | **created_at** |
**updated_at** |
+| --------- | ------------------------------------ | ----------------------- |
------------------------|
+| project_1 | this is one of the test projects | 2022-11-01 01:22:13.000 |
2022-11-01 02:24:15.000 |
+| project_2 | this is another project test project | 2022-11-01 01:23:29.000 |
2022-11-01 02:27:24.000 |
+
+## project_metrics
+
+| **field** | **type** | **length** | **description**
| **key** |
+| --------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `plugin_name` | varchar | 255 | name for plugin
| PK |
+| `plugin_option` | longtext | | check if metric plugins have been
enabled by the project | |
+| `enable` | tinyint | 1 | if the metric plugins is enabled
| |
+
+
+| **project_name** | **plugin_name** | **plugin_option** | **enable** |
+| ---------------- | --------------- | ----------------- | ---------- |
+| project_1 | gitlab | {} | true |
+| project_2 | gitlab | {} | false |
+| project_2 | github | {} | true |
+
+## project_mapping
+
+| **field** | **type** | **length** | **description**
| **key** |
+| -------------- | -------- | ---------- |
---------------------------------------------------------- | ------- |
+| `project_name` | varchar | 255 | name for project
| PK |
+| `scope_id` | bigint | 255 | the scope id by project mapping
| PK |
+
+
+| **project_name** | **scope_id** |
+| ---------------- | ------------ |
+| project_1 | 1 |
+| project_1 | 2 |
+| project_2 | 1 |
+
+
+It requires each plugin to implement an interface named `PluginMetric`
+
+# 如何使用 Project
+
+1. 首先我们可以通过 `POST` `/project` 接口来创建一个全新的 `project` 对象,该对象需要一个
`project_name`字段,作为其名称,该名称唯一。
+
+当我们创建出 `project` 对象之后:
+
+- 我们可以通过 `GET` `/project` 接口来获取具体的的某一个
`project`的信息,除了名称外,这些信息里也包含了project的更新时间和创建时间。
+- 我们可以通过 `UPDATE` `/project` 接口来更新具体的某一个 `project`的信息,比如更新其相关的 `描述` 信息。
+- 我们可以通过 `GET` `/projects` 接口来获取所有的`project`信息。
+
+2. 与此同时,我们可以通过 `GET` `/plugininfo` 接口来获取到 完整详细的 `插件` 信息,其中包括对应 `插件`
的每个表的结构信息。除此以外,我们也可以通过调用相对简单的 `GET` `/plugins`
来获取更为简洁的插件信息。简洁的插件信息仅包含插件名称,也就是`plugin_name`组成的列表,除此之外不包含其他任何信息。
Review Comment:
"为了能给 project 指定需要的指标,你可以通过 `GET /plugins` 接口来获取插件信息。"
复杂的接口就不用提了,那个主要返回 model 信息对这个场景帮助不大。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]