db: use context and go-mockgen for login sources (#7041)

This commit is contained in:
Joe Chen
2022-06-10 19:54:36 +08:00
committed by GitHub
parent 94059f291d
commit 9776bdc9b8
14 changed files with 2175 additions and 407 deletions

View File

@@ -22,7 +22,7 @@ func parseLoginSource(c *context.APIContext, u *db.User, sourceID int64, loginNa
return
}
source, err := db.LoginSources.GetByID(sourceID)
source, err := db.LoginSources.GetByID(c.Req.Context(), sourceID)
if err != nil {
if db.IsErrLoginSourceNotExist(err) {
c.ErrorStatus(http.StatusUnprocessableEntity, err)