Add issue type to the campaign model
This commit is contained in:
parent
89c55b1a8c
commit
340c821a5b
3 changed files with 17 additions and 13 deletions
13
cmd/init.go
13
cmd/init.go
|
@ -25,6 +25,7 @@ func InitCmd() *cobra.Command {
|
||||||
_ = cmd.MarkFlagRequired("summary")
|
_ = cmd.MarkFlagRequired("summary")
|
||||||
cmd.Flags().StringP("template", "t", "", "The template path for the description of the tickets")
|
cmd.Flags().StringP("template", "t", "", "The template path for the description of the tickets")
|
||||||
_ = cmd.MarkFlagRequired("template")
|
_ = cmd.MarkFlagRequired("template")
|
||||||
|
cmd.Flags().StringP("issue-type", "i", "Story", "The issue type to create the tickets as")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -35,13 +36,15 @@ func initCmdF(cmd *cobra.Command, _ []string) {
|
||||||
epic, _ := cmd.Flags().GetString("epic")
|
epic, _ := cmd.Flags().GetString("epic")
|
||||||
summary, _ := cmd.Flags().GetString("summary")
|
summary, _ := cmd.Flags().GetString("summary")
|
||||||
template, _ := cmd.Flags().GetString("template")
|
template, _ := cmd.Flags().GetString("template")
|
||||||
|
issueType, _ := cmd.Flags().GetString("issue-type")
|
||||||
|
|
||||||
cmp := &model.Campaign{
|
cmp := &model.Campaign{
|
||||||
Url: url,
|
Url: url,
|
||||||
Project: project,
|
Project: project,
|
||||||
Epic: epic,
|
Epic: epic,
|
||||||
Summary: summary,
|
IssueType: issueType,
|
||||||
Template: template,
|
Summary: summary,
|
||||||
|
Template: template,
|
||||||
}
|
}
|
||||||
if err := campaign.Save(cmp); err != nil {
|
if err := campaign.Save(cmp); err != nil {
|
||||||
ErrorAndExit(cmd, err)
|
ErrorAndExit(cmd, err)
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (c *JiraClient) GetIssueFromTicket(ticket *model.Ticket, campaign *model.Ca
|
||||||
"Description": description,
|
"Description": description,
|
||||||
"Summary": summary,
|
"Summary": summary,
|
||||||
"Project": campaign.Project,
|
"Project": campaign.Project,
|
||||||
"Issue Type": "Story",
|
"Issue Type": campaign.IssueType,
|
||||||
"Epic Link": campaign.Epic,
|
"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)
|
return nil, fmt.Errorf("Error retrieving project with key %s", campaign.Project)
|
||||||
}
|
}
|
||||||
|
|
||||||
issueType := project.GetIssueTypeWithName("Story")
|
issueType := project.GetIssueTypeWithName(campaign.IssueType)
|
||||||
if issueType == nil {
|
if issueType == nil {
|
||||||
return nil, fmt.Errorf("Error retrieving issue type with name Story")
|
return nil, fmt.Errorf("Error retrieving issue type with name Story")
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,11 @@ package model
|
||||||
|
|
||||||
// ToDo: add key-value extra params as a map to allow for customfield_whatever = team
|
// ToDo: add key-value extra params as a map to allow for customfield_whatever = team
|
||||||
type Campaign struct {
|
type Campaign struct {
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
Project string `json:"project"`
|
Project string `json:"project"`
|
||||||
Epic string `json:"epic"`
|
Epic string `json:"epic"`
|
||||||
Summary string `json:"summary"`
|
IssueType string `json:"issue_type"`
|
||||||
Template string `json:"template"`
|
Summary string `json:"summary"`
|
||||||
Tickets []*Ticket `json:"tickets,omitempty"`
|
Template string `json:"template"`
|
||||||
|
Tickets []*Ticket `json:"tickets,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue