mindlesscloud commented on code in PR #453: URL: https://github.com/apache/incubator-devlake-website/pull/453#discussion_r1124325634
########## docs/Plugins/customize.md: ########## @@ -75,25 +82,129 @@ curl 'http://localhost:8080/pipelines' \ } ' ``` -Get all extension columns(start with `x_`) of the table `issues` + +### List Columns +Get all columns of the table `issues` > GET /plugins/customize/issues/fields +**NOTE** some fields are omitted in the following example response ```json [ - { - "columnName": "x_test", - "columnType": "VARCHAR(255)" - } + { + "columnName": "id", + "displayName": "", + "dataType": "varchar(255)", + "description": "" + }, + { + "columnName": "created_at", + "displayName": "", + "dataType": "datetime(3)", + "description": "" + }, + { + "columnName": "x_time", + "displayName": "time", + "dataType": "timestamp", + "description": "test for time" + }, + { + "columnName": "x_int", + "displayName": "bigint", + "dataType": "bigint", + "description": "test for int" + }, + { + "columnName": "x_float", + "displayName": "float", + "dataType": "float", + "description": "test for float" + }, + { + "columnName": "x_text", + "displayName": "text", + "dataType": "text", + "description": "test for text" + }, + { + "columnName": "x_varchar", + "displayName": "varchar", + "dataType": "varchar(255)", + "description": "test for varchar" + } ] + ``` -Create extension column `x_test` for the table `issues` + +### Create A Customized Column +Create a new column `x_abc` with datatype `varchar(255)` for the table `issues`. +The value of `columnName` must start with `x_` and consist of no more than 50 alphanumerics and underscores +The value of field `dataType` must be one of the following 5 types: +- varchar(255) +- text +- bigint +- float +- timestamp > POST /plugins/customize/issues/fields ```json { - "name": "x_test" + "columnName": "x_abc", + "displayName": "ABC", + "dataType": "varchar(255)", + "description": "test field" } ``` + +### Drop A Column Drop the column `x_text` for the table `issues` + > DELETE /plugins/customize/issues/fields/x_test + +### Upload `issues.csv` file + +> POST /plugins/customize/csvfiles/issues.csv + +The HTTP `Content-Type` must be `multipart/form-data`, and the form should have three fields: + +- `file` the CSV file +- `boardId` It will be written to the `id` field of the `boards` table, the `board_id` field of `board_issues`, and the `_raw_data_params` field of `issues` +- `boardName` It will be written to the `name` field of the `boards` table + +Upload a CSV file and import it to the `issues` table via this API. There should be no extra fields in the file except the `labels` field, +and if the field value is `NULL`, it should be `NULL` in the CSV instead of the empty string. +DevLake will parse the CSV file and store it in the `issues` table, where the `labels` are stored in the `issue_labels` table. +If the `boardId` does not appear, a new record will be created in the boards table. The `board_issues` table will be updated at the same time as the import. +The following is an issues.CSV file sample: + +|id |created_at |updated_at |_raw_data_params |_raw_data_table |_raw_data_id|_raw_data_remark|url |icon_url|issue_key|title |description |epic_key|type |status|original_status|story_point|resolution_date|created_date |updated_date |parent_issue_id|priority|original_estimate_minutes|time_spent_minutes|time_remaining_minutes|creator_id |creator_name|assignee_id |assignee_name|severity|component|lead_time_minutes|original_project|original_type|x_int |x_time |x_varchar|x_float|labels | Review Comment: No, it was set by the code. However, usually, the orm framework will help us set them up automatically -- 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]
