diff options
author | 6543 <6543@obermui.de> | 2020-12-03 15:05:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 16:05:48 +0200 |
commit | 4353cf96c003cf55adfaf28b494a9d78c5226202 (patch) | |
tree | 15a80476df2ec0f0aefcca71385c9873752b96e1 /modules/convert | |
parent | e306c292ac478c0f09b2c02908e485132669aacb (diff) | |
download | gitea-4353cf96c003cf55adfaf28b494a9d78c5226202.tar.gz gitea-4353cf96c003cf55adfaf28b494a9d78c5226202.zip |
Move LFSLock APIFormat into convert package (#13808)
Diffstat (limited to 'modules/convert')
-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(), + }, + } +} |