issueChangelogHandler saves a record into the `issue_changelogs` table
(record map[string]interface{})
| 622 | |
| 623 | // issueChangelogHandler saves a record into the `issue_changelogs` table |
| 624 | func (s *Service) issueChangelogHandler(record map[string]interface{}) errors.Error { |
| 625 | // create account |
| 626 | authorName, err := getStringField(record, "author_name", false) |
| 627 | if err != nil { |
| 628 | return err |
| 629 | } |
| 630 | rawDataParams, err := getStringField(record, "_raw_data_params", true) |
| 631 | if err != nil { |
| 632 | return err |
| 633 | } |
| 634 | if authorName != "" { |
| 635 | authorId, err := s.createOrUpdateAccount(authorName, rawDataParams) |
| 636 | if err != nil { |
| 637 | return err |
| 638 | } |
| 639 | record["author_id"] = authorId |
| 640 | } |
| 641 | // set field_id = field_name |
| 642 | fieldName, err := getStringField(record, "field_name", true) |
| 643 | if err != nil { |
| 644 | return err |
| 645 | } |
| 646 | record["field_id"] = fieldName |
| 647 | // handle assignee |
| 648 | if fieldName == "assignee" { |
| 649 | originalFromValue, err := getStringField(record, "original_from_value", false) |
| 650 | if err != nil { |
| 651 | return err |
| 652 | } |
| 653 | originalToValue, err := getStringField(record, "original_to_value", false) |
| 654 | if err != nil { |
| 655 | return err |
| 656 | } |
| 657 | fromId, err := s.createOrUpdateAccount(originalFromValue, rawDataParams) |
| 658 | if err != nil { |
| 659 | return err |
| 660 | } |
| 661 | record["original_from_value"] = fromId |
| 662 | toId, err := s.createOrUpdateAccount(originalToValue, rawDataParams) |
| 663 | if err != nil { |
| 664 | return err |
| 665 | } |
| 666 | record["original_to_value"] = toId |
| 667 | } |
| 668 | return s.dal.CreateWithMap(&ticket.IssueChangelogs{}, record) |
| 669 | } |
| 670 | |
| 671 | // ImportIssueWorklog imports csv file into the table `issue_worklogs` |
| 672 | func (s *Service) ImportIssueWorklog(boardId string, file io.ReadCloser, incremental bool) errors.Error { |
nothing calls this directly
no test coverage detected