mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-22 00:08:30 -04:00
Move LFSLock APIFormat into convert package (#13808)
This commit is contained in:
parent
e306c292ac
commit
4353cf96c0
3 changed files with 22 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue