klesh commented on issue #2802:
URL:
https://github.com/apache/incubator-devlake/issues/2802#issuecomment-1225491661
# Requirement (from @leglars)
1. A set of APIs to manage customize-jira-issue-fields on the fly, including
list/add/delete
2. The `field name` should be customizable at table level.
3. User should be able to specify the mapping between `raw issue json` and
`jira issue table`
# Solution
This is an advanced feature, we don't know if it would thrive or not, we
keep it minimal and see how it goes.
## Points
- All customize-jira-issue-fields (hereafter this text will be abbreviated
as CJIF) should be prefixed with `x_`, so we could distinguish them from normal
fields.
- `varchar255` is the only supported type at the moment.
- no indexing or any other complicated features.
## Plan of attack
1. `GET /plugins/jira/customize/issues/fields` to return a list of all CJIF,
that is fields with prefix `x_`
```json
[
{ "name": "<FIELD_NAME>", "columnName": "x_<FIELD_NAME>", "columnType":
"varchar(255)" },
...
]
```
2. `POST /plugins/jira/customize/issues/fields` to create a new CJIF, the
name of the field must be verified, and a field named `x_<FIELD_NAME>` should
be created in `jira issues` table with type `varchar(255)`.
REQUEST
```json
{ "name": "<FIELD_NAME>" }
```
RESPONSE
```json
{ "name": "<FIELD_NAME>", "columnName": "x_<FIELD_NAME>", "columnType":
"varchar(255)" }
```
3. `DELETE /plugins/jira/customize/issues/fields/<FIELD_NAME>` to delete the
specified CJIF.
4. Update `jira transformation rules` to accept a `map[string][string]` as
the mapping between `raw json` and `jira issue`
NEW TRANSFORMATION RULES
```json
{
...,
"customizeFields": {
"<JSON_PATH_FOR_RAW_JSON>": "<FIELD_NAME>", //
"fields.customfield_10020.0.id": "sprint_id"
...
}
}
```
5. Define a new interface named `DynamicFields` under `core/dal` with
methods `GetDynamicFields` and `SetDynamicFields` with type
`map[string]interface{}`
6. `jira issue` implement the `DynamicFields` interface,
7. Update the `jira issue extractor`, ADD new logic to handle the CJIF
extraction, and call `SetDynamicFields`
8. Update the `BatchSave.Flush`, check if the entity implemented
`DynamicFields`, and do an extra UPDATE operation accordingly
https://gorm.io/docs/update.html#Updates-multiple-columns
9. Update swagger document
10. Update office document
--
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]