Add issue type to the campaign model

This commit is contained in:
Miguel de la Cruz 2020-03-05 21:31:20 +01:00
parent 89c55b1a8c
commit 340c821a5b
3 changed files with 17 additions and 13 deletions

View file

@ -25,6 +25,7 @@ func InitCmd() *cobra.Command {
_ = cmd.MarkFlagRequired("summary")
cmd.Flags().StringP("template", "t", "", "The template path for the description of the tickets")
_ = cmd.MarkFlagRequired("template")
cmd.Flags().StringP("issue-type", "i", "Story", "The issue type to create the tickets as")
return cmd
}
@ -35,11 +36,13 @@ func initCmdF(cmd *cobra.Command, _ []string) {
epic, _ := cmd.Flags().GetString("epic")
summary, _ := cmd.Flags().GetString("summary")
template, _ := cmd.Flags().GetString("template")
issueType, _ := cmd.Flags().GetString("issue-type")
cmp := &model.Campaign{
Url: url,
Project: project,
Epic: epic,
IssueType: issueType,
Summary: summary,
Template: template,
}

View file

@ -41,7 +41,7 @@ func (c *JiraClient) GetIssueFromTicket(ticket *model.Ticket, campaign *model.Ca
"Description": description,
"Summary": summary,
"Project": campaign.Project,
"Issue Type": "Story",
"Issue Type": campaign.IssueType,
"Epic Link": campaign.Epic,
}
@ -59,7 +59,7 @@ func (c *JiraClient) GetIssueFromTicket(ticket *model.Ticket, campaign *model.Ca
return nil, fmt.Errorf("Error retrieving project with key %s", campaign.Project)
}
issueType := project.GetIssueTypeWithName("Story")
issueType := project.GetIssueTypeWithName(campaign.IssueType)
if issueType == nil {
return nil, fmt.Errorf("Error retrieving issue type with name Story")
}

View file

@ -5,6 +5,7 @@ type Campaign struct {
Url string `json:"url"`
Project string `json:"project"`
Epic string `json:"epic"`
IssueType string `json:"issue_type"`
Summary string `json:"summary"`
Template string `json:"template"`
Tickets []*Ticket `json:"tickets,omitempty"`