aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_tracked_time.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-10-31 19:25:14 -0700
committerLunny Xiao <xiaolunwen@gmail.com>2017-11-01 10:25:14 +0800
commite6a97b667598ca4a94ee58fff9e171c284769c39 (patch)
treed66c3787de754199eacf9b99b40b7a5bbd2bd8b7 /models/issue_tracked_time.go
parente22549747c1d8793f74b8d6b1741e9806bc9a7ca (diff)
downloadgitea-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.go13
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