diff options
Diffstat (limited to 'modules/convert/convert.go')
-rw-r--r-- | modules/convert/convert.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/convert/convert.go b/modules/convert/convert.go index 9b20c683be..4d4d9396fe 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -7,6 +7,8 @@ package convert import ( "fmt" + "strconv" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" @@ -365,3 +367,15 @@ func ToCommitStatus(status *models.CommitStatus) *api.Status { return apiStatus } + +// ToLFSLock convert a LFSLock to api.LFSLock +func ToLFSLock(l *models.LFSLock) *api.LFSLock { + return &api.LFSLock{ + ID: strconv.FormatInt(l.ID, 10), + Path: l.Path, + LockedAt: l.Created.Round(time.Second), + Owner: &api.LFSLockOwner{ + Name: l.Owner.DisplayName(), + }, + } +} |