-
Notifications
You must be signed in to change notification settings - Fork 81
/
card.go
66 lines (59 loc) · 2.32 KB
/
card.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package models
import "fmt"
// Card represents an card in kanban board
type Card struct {
Id int64 `json:"id"`
Iid int64 `json:"iid"`
Assignee *User `json:"assignee"`
Milestone *Milestone `json:"milestone"`
Author *User `json:"author"`
Description string `json:"description"`
Labels *[]string `json:"labels"`
ProjectId int64 `json:"project_id"`
BoardID string `json:"board_id"`
PathWithNamespace string `json:"path_with_namespace"`
Properties *Properties `json:"properties"`
State string `json:"state"`
Title string `json:"title"`
Todo []*Todo `json:"todo"`
TodoMetrics *TodoMetrics `json:"todo_metrics"`
UserCommentsCount int `json:"user_comments_count"`
Subscribed bool `json:"subscribed"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
DueDate string `json:"due_date"`
Confidential bool `json:"confidential"`
WebURL string `json:"web_url"`
}
// TodoMetrics represents metrics by todo for card
type TodoMetrics struct {
Checked int `json:"checked"`
Quantity int `json:"quantity"`
}
// Properties represents a card properties
type Properties struct {
Andon string `json:"andon"`
}
// Todo represents an todo an card
type Todo struct {
Body string `json:"body"`
Checked bool `json:"checked"`
}
// CardRequest represents a card request for create, update, delete card on kanban
type CardRequest struct {
CardId int64 `json:"issue_id"`
ProjectId int64 `json:"project_id"`
Title string `json:"title"`
Description string `json:"description"`
AssigneeId *int64 `json:"assignee_id"`
MilestoneId *int64 `json:"milestone_id"`
Labels string `json:"labels"`
Properties *Properties `json:"properties"`
Stage map[string]string `json:"stage"`
Todo []*Todo `json:"todo"`
DueDate string `json:"due_date"`
Confidential bool `json:"confidential"`
}
func (c *Card) RoutingKey() string {
return fmt.Sprintf("kanban.%d", c.ProjectId)
}