1
0
Fork 0
forked from forgejo/forgejo

Use api.TrackedTime in API (#2807)

* Use api.TrackedTime in API

* APIFormat() method

* Rename function
This commit is contained in:
Ethan Koenig 2017-10-31 19:25:14 -07:00 committed by Lunny Xiao
parent e22549747c
commit e6a97b6675
2 changed files with 47 additions and 16 deletions

View file

@ -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