forked from forgejo/forgejo
Use api.TrackedTime in API (#2807)
* Use api.TrackedTime in API * APIFormat() method * Rename function
This commit is contained in:
parent
e22549747c
commit
e6a97b6675
2 changed files with 47 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue