lfs: implement HTTP routes (#6035)

* Bootstrap with GORM

* Fix lint error

* Set conn max lifetime to one minute

* Fallback to use gorm v1

* Define HTTP routes

* Finish authentication

* Save token updated

* Add docstring

* Finish authorization

* serveBatch rundown

* Define types in lfsutil

* Finish Batch

* authutil

* Finish basic

* Formalize response error

* Fix lint errors

* authutil: add tests

* dbutil: add tests

* lfsutil: add tests

* strutil: add tests

* Formalize 401 response
This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-04-04 21:14:15 +08:00
committed by GitHub
parent 2bd9d0b9c8
commit 34145c990d
69 changed files with 1847 additions and 558 deletions

View File

@@ -23,7 +23,7 @@ func parseLoginSource(c *context.APIContext, u *db.User, sourceID int64, loginNa
return
}
source, err := db.GetLoginSourceByID(sourceID)
source, err := db.LoginSources.GetByID(sourceID)
if err != nil {
if errors.IsLoginSourceNotExist(err) {
c.ErrorStatus(http.StatusUnprocessableEntity, err)
@@ -45,7 +45,7 @@ func CreateUser(c *context.APIContext, form api.CreateUserOption) {
Email: form.Email,
Passwd: form.Password,
IsActive: true,
LoginType: db.LOGIN_PLAIN,
LoginType: db.LoginPlain,
}
parseLoginSource(c, u, form.SourceID, form.LoginName)