mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move LFSLock APIFormat into convert package (#13808)
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user