add automatic database migrations with goose

This commit is contained in:
2021-09-28 00:36:14 +02:00
parent 5b2eff3f6d
commit 0df96a093f
9 changed files with 196 additions and 121 deletions

View File

@ -3,16 +3,11 @@ package api
import (
"fmt"
"github.com/dgrijalva/jwt-go"
"gopkg.in/oauth2.v3"
"gopkg.in/oauth2.v3/server"
"net/http"
"openmediacenter/apiGo/database"
"strconv"
"time"
)
var srv *server.Server
type Perm uint8
const (
@ -103,15 +98,3 @@ func InitOAuth() {
})
})
}
func ValidateToken(f func(rw http.ResponseWriter, req *http.Request, node int, tokenInfo *oauth2.TokenInfo), node int) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
tokeninfo, err := srv.ValidationBearerToken(r)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
f(w, r, node, &tokeninfo)
}
}