refactor: call database functions from app.Server.Database instead of directly from db
This commit is contained in:
@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/fossyy/filekeeper/app"
|
||||
"github.com/fossyy/filekeeper/cache"
|
||||
"github.com/fossyy/filekeeper/db"
|
||||
googleOauthSetupHandler "github.com/fossyy/filekeeper/handler/auth/google/setup"
|
||||
signinHandler "github.com/fossyy/filekeeper/handler/signin"
|
||||
"github.com/fossyy/filekeeper/session"
|
||||
@ -145,7 +144,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if !db.DB.IsEmailRegistered(oauthUser.Email) {
|
||||
if !app.Server.Database.IsEmailRegistered(oauthUser.Email) {
|
||||
code := utils.GenerateRandomString(64)
|
||||
googleOauthSetupHandler.SetupUser[code] = &googleOauthSetupHandler.UnregisteredUser{
|
||||
Code: code,
|
||||
|
@ -3,7 +3,6 @@ package googleOauthSetupHandler
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fossyy/filekeeper/app"
|
||||
"github.com/fossyy/filekeeper/db"
|
||||
signinHandler "github.com/fossyy/filekeeper/handler/signin"
|
||||
"github.com/fossyy/filekeeper/session"
|
||||
"github.com/fossyy/filekeeper/types"
|
||||
@ -112,7 +111,7 @@ func POST(w http.ResponseWriter, r *http.Request) {
|
||||
Password: hashedPassword,
|
||||
}
|
||||
|
||||
err = db.DB.CreateUser(&newUser)
|
||||
err = app.Server.Database.CreateUser(&newUser)
|
||||
if err != nil {
|
||||
component := signupView.Main("Filekeeper - Sign up Page", types.Message{
|
||||
Code: 0,
|
||||
|
Reference in New Issue
Block a user