TaskFlow/types/types.go

66 lines
1.7 KiB
Go
Raw Normal View History

2015-11-13 17:04:42 +08:00
package types
2016-02-01 22:34:19 +08:00
/*
Package types is used to store the context struct which
is passed while templates are executed.
*/
2015-11-21 21:20:51 +08:00
//Task is the struct used to identify tasks
2015-11-13 17:04:42 +08:00
type Task struct {
Id int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Created string `json:"created"`
Priority string `json:"priority"`
Category string `json:"category"`
Referer string `json:"referer,omitempty"`
Comments []Comment `json:"comments,omitempty"`
IsOverdue bool `json:"isoverdue, omitempty"`
IsHidden int `json:"ishidden, omitempty`
CompletedMsg string `json:"ishidden, omitempty"`
}
2016-05-22 17:40:55 +08:00
type Tasks []Task
//Comment is the struct used to populate comments per tasks
type Comment struct {
2016-05-22 17:40:55 +08:00
ID int `json:"id"`
Content string `json:"content"`
Created string `json:"created_date"`
Username string `json:"username"`
2015-11-13 17:04:42 +08:00
}
2015-11-21 21:20:51 +08:00
//Context is the struct passed to templates
type Context struct {
Tasks []Task
Navigation string
2015-11-21 22:12:44 +08:00
Search string
2015-11-22 11:51:29 +08:00
Message string
2016-01-18 09:02:15 +08:00
CSRFToken string
2016-02-05 03:39:36 +08:00
Categories []CategoryCount
2016-02-06 18:02:46 +08:00
Referer string
2016-02-05 03:39:36 +08:00
}
//CategoryCount is the struct used to populate the sidebar
//which contains the category name and the count of the tasks
//in each category
type CategoryCount struct {
Name string
Count int
2015-11-21 21:20:51 +08:00
}
2016-05-22 17:40:55 +08:00
//Status is the JSON struct to be returned
type Status struct {
StatusCode int `json:"status_code"`
Message string `json:"message"`
}
//Category is the structure of the category table
type Category struct {
ID int `json:"category_id"`
Name string `json:"category_name"`
Created string `json:"created_date"`
}
//Categories will show
type Categories []Category