gofmt
This commit is contained in:
parent
110361361b
commit
b4b0b737a3
2
main.go
2
main.go
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/routes"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"git.mowie.cc/konrad/Library/routes"
|
||||
|
||||
"fmt"
|
||||
)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package models
|
||||
|
||||
|
||||
func ListAuthors(searchterm string) (authors []Author, err error) {
|
||||
|
||||
if searchterm == "" {
|
||||
|
|
|
@ -23,7 +23,6 @@ func ListBooks(searchterm string) (books []*Book, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Get all authors and publishers
|
||||
for i, book := range books {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/core"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/go-xorm/xorm"
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/go-xorm/core"
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
var x *xorm.Engine
|
||||
|
@ -15,7 +15,6 @@ func getEngine() (*xorm.Engine, error){
|
|||
return xorm.NewEngine("mysql", connStr)
|
||||
}
|
||||
|
||||
|
||||
// SetEngine sets the xorm.Engine
|
||||
func SetEngine() (err error) {
|
||||
x, err = getEngine()
|
||||
|
|
|
@ -14,6 +14,5 @@ func DeletePublisherByID(id int64) error {
|
|||
//_, err = x.Where("publisher = ?", id).Update(book)
|
||||
_, err = x.Table("books").Where("publisher = ?", id).Update(map[string]interface{}{"publisher": 0})
|
||||
|
||||
|
||||
return err
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"fmt"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
"strconv"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func AuthorDelete(c echo.Context) error {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
)
|
||||
|
||||
func AuthorsList(c echo.Context) error {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func AuthorUpdate(c echo.Context) error {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
"strconv"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func BookDelete(c echo.Context) error {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
"strconv"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func PublisherDelete(c echo.Context) error {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
)
|
||||
|
||||
func PublishersList(c echo.Context) error {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func PublisherUpdate(c echo.Context) error {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"fmt"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/labstack/echo"
|
||||
)
|
||||
|
||||
func CheckToken(c echo.Context) error {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package routes
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"time"
|
||||
"net/http"
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Login(c echo.Context) error {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package routes
|
||||
|
||||
import (
|
||||
apiv1 "git.mowie.cc/konrad/Library/routes/api/v1"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/middleware"
|
||||
apiv1 "git.mowie.cc/konrad/Library/routes/api/v1"
|
||||
|
||||
"git.mowie.cc/konrad/Library/models"
|
||||
)
|
||||
|
@ -44,7 +44,6 @@ func RegisterRoutes(e *echo.Echo) {
|
|||
// Login Route
|
||||
e.POST("/login", Login)
|
||||
|
||||
|
||||
// ===== Routes with Authetification =====
|
||||
// Authetification
|
||||
a.Use(middleware.JWT(models.Config.JWTLoginSecret))
|
||||
|
|
Loading…
Reference in New Issue