diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-10-31 19:25:14 -0700 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-11-01 10:25:14 +0800 |
commit | e6a97b667598ca4a94ee58fff9e171c284769c39 (patch) | |
tree | d66c3787de754199eacf9b99b40b7a5bbd2bd8b7 /models/issue_tracked_time.go | |
parent | e22549747c1d8793f74b8d6b1741e9806bc9a7ca (diff) | |
download | gitea-e6a97b667598ca4a94ee58fff9e171c284769c39.tar.gz gitea-e6a97b667598ca4a94ee58fff9e171c284769c39.zip |
Use api.TrackedTime in API (#2807)
* Use api.TrackedTime in API
* APIFormat() method
* Rename function
Diffstat (limited to 'models/issue_tracked_time.go')
-rw-r--r-- | models/issue_tracked_time.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/issue_tracked_time.go b/models/issue_tracked_time.go index b1c82b6207..3b2360f68f 100644 --- a/models/issue_tracked_time.go +++ b/models/issue_tracked_time.go @@ -7,6 +7,8 @@ package models import ( "time" + api "code.gitea.io/sdk/gitea" + "github.com/go-xorm/builder" ) @@ -25,6 +27,17 @@ func (t *TrackedTime) AfterLoad() { t.Created = time.Unix(t.CreatedUnix, 0).Local() } +// APIFormat converts TrackedTime to API format +func (t *TrackedTime) APIFormat() *api.TrackedTime { + return &api.TrackedTime{ + ID: t.ID, + IssueID: t.IssueID, + UserID: t.UserID, + Time: t.Time, + Created: t.Created, + } +} + // FindTrackedTimesOptions represent the filters for tracked times. If an ID is 0 it will be ignored. type FindTrackedTimesOptions struct { IssueID int64 |