Add status column for each projectItem object.

This should be comparable to classic project's notion of column, although not _exactly_ the same since new projects are much more configurable.
This commit is contained in:
Matthew Ruggio 2023-10-13 07:56:42 -05:00
parent bc0f63b043
commit 8a868779a6
4 changed files with 15 additions and 2 deletions

View file

@ -23,7 +23,8 @@ func (issue *Issue) ExportData(fields []string) map[string]interface{} {
items := make([]map[string]interface{}, 0, len(issue.ProjectItems.Nodes))
for _, n := range issue.ProjectItems.Nodes {
items = append(items, map[string]interface{}{
"title": n.Project.Title,
"status": n.Status,
"title": n.Project.Title,
})
}
data[f] = items

View file

@ -85,6 +85,10 @@ func TestIssue_ExportData(t *testing.T) {
"project": {
"id": "PVT_id",
"title": "Some Project"
},
"status": {
"name": "Todo",
"optionId": "abc123"
}
}
] } }
@ -93,6 +97,10 @@ func TestIssue_ExportData(t *testing.T) {
{
"projectItems": [
{
"status": {
"optionId": "abc123",
"name": "Todo"
},
"title": "Some Project"
}
]

View file

@ -106,6 +106,10 @@ type ProjectV2Item struct {
ID string `json:"id"`
Title string `json:"title"`
}
Status struct {
OptionID string `json:"optionId"`
Name string `json:"name"`
}
}
func (p ProjectCards) ProjectNames() []string {

View file

@ -318,7 +318,7 @@ func IssueGraphQL(fields []string) string {
case "projectCards":
q = append(q, `projectCards(first:100){nodes{project{name}column{name}},totalCount}`)
case "projectItems":
q = append(q, `projectItems(first:100){nodes{id, project{id,title}},totalCount}`)
q = append(q, `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`)
case "milestone":
q = append(q, `milestone{number,title,description,dueOn}`)
case "reactionGroups":