Move LFSLock APIFormat into convert package (#13808)

This commit is contained in:
6543 2020-12-03 15:05:48 +01:00 committed by GitHub
parent e306c292ac
commit 4353cf96c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 21 deletions

View file

@ -7,12 +7,10 @@ package models
import (
"fmt"
"path"
"strconv"
"strings"
"time"
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
"xorm.io/xorm"
)
@ -52,18 +50,6 @@ func cleanPath(p string) string {
return path.Clean("/" + p)[1:]
}
// APIFormat convert a Release to lfs.LFSLock
func (l *LFSLock) APIFormat() *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(),
},
}
}
// CreateLFSLock creates a new lock.
func CreateLFSLock(lock *LFSLock) (*LFSLock, error) {
err := CheckLFSAccessForRepo(lock.Owner, lock.Repo, AccessModeWrite)