mirror of
https://lab.forgefriends.org/friendlyforgeformat/gof3.git
synced 2025-10-06 01:52:40 +02:00
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
// Copyright Earl Warren <contact@earl-warren.org>
|
|
// Copyright Loïc Dachary <loic@dachary.org>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package f3
|
|
|
|
import "time"
|
|
|
|
type Issue struct {
|
|
Common
|
|
PosterID *Reference `json:"poster_id"`
|
|
Assignees []*Reference `json:"assignees"`
|
|
Labels []*Reference `json:"labels"`
|
|
Title string `json:"title"`
|
|
Content string `json:"content"`
|
|
Milestone *Reference `json:"milestone"`
|
|
State string `json:"state"` // closed, open
|
|
IsLocked bool `json:"is_locked"`
|
|
Created time.Time `json:"created"`
|
|
Updated time.Time `json:"updated"`
|
|
Closed *time.Time `json:"closed"`
|
|
Ref string `json:"ref"`
|
|
}
|
|
|
|
func (o *Issue) GetReferences() References {
|
|
references := o.Common.GetReferences()
|
|
for _, assignee := range o.Assignees {
|
|
references = append(references, assignee)
|
|
}
|
|
for _, label := range o.Labels {
|
|
references = append(references, label)
|
|
}
|
|
if o.Milestone != nil {
|
|
references = append(references, o.Milestone)
|
|
}
|
|
return append(references, o.PosterID)
|
|
}
|
|
|
|
func (o Issue) GetCmpIgnoreFields() []string {
|
|
return append(o.Common.GetCmpIgnoreFields(), ".Updated", ".Created", ".Closed")
|
|
}
|
|
|
|
func (o *Issue) Clone() Interface {
|
|
clone := &Issue{}
|
|
*clone = *o
|
|
return clone
|
|
}
|