Skip to content

Commit

Permalink
Added RenderedFields and replaced string with time.Time in date fields (
Browse files Browse the repository at this point in the history
#279)

* Added RenderedFields and replaced string with time.Time in date fields

* 🎨

* Added duedate

* test

* Revert "test"

This reverts commit a4c0a42.

* Fixed json

* Fixed json

---------

Co-authored-by: Florian Kinder <[email protected]>
  • Loading branch information
Fank and Fank authored Jun 30, 2024
1 parent e2a43bd commit 2856a1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
22 changes: 13 additions & 9 deletions pkg/infra/models/jira_issue_v2.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package models

import (
"dario.cat/mergo"
"encoding/json"
"time"

"dario.cat/mergo"
)

// IssueSchemeV2 represents the scheme of an issue in Jira version 2.
type IssueSchemeV2 struct {
ID string `json:"id,omitempty"` // The ID of the issue.
Key string `json:"key,omitempty"` // The key of the issue.
Self string `json:"self,omitempty"` // The URL of the issue.
Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue.
Changelog *IssueChangelogScheme `json:"changelog,omitempty"` // The changelog of the issue.
Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` // The fields of the issue.
ID string `json:"id,omitempty"` // The ID of the issue.
Key string `json:"key,omitempty"` // The key of the issue.
Self string `json:"self,omitempty"` // The URL of the issue.
Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue.
Changelog *IssueChangelogScheme `json:"changelog,omitempty"` // The changelog of the issue.
Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` // The fields of the issue.
RenderedFields map[string]interface{} `json:"renderedFields,omitempty"`
}

// MergeCustomFields merges custom fields into the issue scheme.
Expand Down Expand Up @@ -114,15 +117,16 @@ type IssueFieldsSchemeV2 struct {
StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"`
LastViewed string `json:"lastViewed,omitempty"`
Summary string `json:"summary,omitempty"`
Created string `json:"created,omitempty"`
Updated string `json:"updated,omitempty"`
Created *time.Time `json:"created,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
Labels []string `json:"labels,omitempty"`
Status *StatusScheme `json:"status,omitempty"`
Description string `json:"description,omitempty"`
Comment *IssueCommentPageSchemeV2 `json:"comment,omitempty"`
Subtasks []*IssueScheme `json:"subtasks,omitempty"`
Security *SecurityScheme `json:"security,omitempty"`
Worklog *IssueWorklogRichTextPageScheme `json:"worklog,omitempty"`
DueDate string `json:"duedate,omitempty"`
}

// ParentScheme represents the parent of an issue in Jira.
Expand Down
22 changes: 13 additions & 9 deletions pkg/infra/models/jira_issue_v3.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package models

import (
"dario.cat/mergo"
"encoding/json"
"time"

"dario.cat/mergo"
)

// IssueScheme represents an issue in Jira.
type IssueScheme struct {
ID string `json:"id,omitempty"`
Key string `json:"key,omitempty"`
Self string `json:"self,omitempty"`
Transitions []*IssueTransitionScheme `json:"transitions,omitempty"`
Changelog *IssueChangelogScheme `json:"changelog,omitempty"`
Fields *IssueFieldsScheme `json:"fields,omitempty"`
ID string `json:"id,omitempty"`
Key string `json:"key,omitempty"`
Self string `json:"self,omitempty"`
Transitions []*IssueTransitionScheme `json:"transitions,omitempty"`
Changelog *IssueChangelogScheme `json:"changelog,omitempty"`
Fields *IssueFieldsScheme `json:"fields,omitempty"`
RenderedFields map[string]interface{} `json:"renderedFields,omitempty"`
}

// MergeCustomFields merges the custom fields into the issue.
Expand Down Expand Up @@ -114,8 +117,8 @@ type IssueFieldsScheme struct {
StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` // The date the status category changed.
LastViewed string `json:"lastViewed,omitempty"` // The last time the issue was viewed.
Summary string `json:"summary,omitempty"` // The summary of the issue.
Created string `json:"created,omitempty"` // The date the issue was created.
Updated string `json:"updated,omitempty"` // The date the issue was last updated.
Created *time.Time `json:"created,omitempty"` // The date the issue was created.
Updated *time.Time `json:"updated,omitempty"` // The date the issue was last updated.
Labels []string `json:"labels,omitempty"` // The labels associated with the issue.
Status *StatusScheme `json:"status,omitempty"` // The status of the issue.
Description *CommentNodeScheme `json:"description,omitempty"` // The description of the issue.
Expand All @@ -124,6 +127,7 @@ type IssueFieldsScheme struct {
Security *SecurityScheme `json:"security,omitempty"` // The security level of the issue.
Attachment []*AttachmentScheme `json:"attachment,omitempty"` // The attachments of the issue.
Worklog *IssueWorklogADFPageScheme `json:"worklog,omitempty"` // The worklog of the issue.
DueDate string `json:"duedate,omitempty"` // The due date of the issue.
}

// IssueTransitionScheme represents a transition of an issue in Jira.
Expand Down

0 comments on commit 2856a1b

Please sign in to comment.