| 340 | } |
| 341 | |
| 342 | func buildEditDraftIssue(config editItemConfig, currentDraftIssue *queries.DraftIssue) (*EditProjectDraftIssue, map[string]any) { |
| 343 | input := githubv4.UpdateProjectV2DraftIssueInput{ |
| 344 | DraftIssueID: githubv4.ID(config.opts.itemID), |
| 345 | } |
| 346 | |
| 347 | if config.opts.titleChanged { |
| 348 | input.Title = new(githubv4.String(config.opts.title)) |
| 349 | } else if currentDraftIssue != nil { |
| 350 | // Preserve existing if title is not provided |
| 351 | input.Title = new(githubv4.String(currentDraftIssue.Title)) |
| 352 | } |
| 353 | |
| 354 | if config.opts.bodyChanged { |
| 355 | input.Body = new(githubv4.String(config.opts.body)) |
| 356 | } else if currentDraftIssue != nil { |
| 357 | // Preserve existing if body is not provided |
| 358 | input.Body = new(githubv4.String(currentDraftIssue.Body)) |
| 359 | } |
| 360 | |
| 361 | return &EditProjectDraftIssue{}, map[string]any{ |
| 362 | "input": input, |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | func buildUpdateItem(config editItemConfig, date time.Time) (*UpdateProjectV2FieldValue, map[string]any) { |
| 367 | var value githubv4.ProjectV2FieldValue |