Better resilience against crashes

Even better resilience against crashes

Fixed stuff

Renamed API service

Fixed some paths

Simplified error handling

Updated README
This commit is contained in:
2021-09-04 16:24:48 +02:00
parent 8d251e545f
commit d6fd4e705f
16 changed files with 2080 additions and 182 deletions

View File

@@ -7,7 +7,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/gofiber/fiber/v2"
"gitlab.larvit.se/power-plan/auth/src/db"
"gitlab.larvit.se/power-plan/auth-api/src/db"
)
func (h Handlers) returnTokens(account db.Account, c *fiber.Ctx) error {

View File

@@ -5,8 +5,8 @@ import (
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"gitlab.larvit.se/power-plan/auth/src/db"
"gitlab.larvit.se/power-plan/auth/src/utils"
"gitlab.larvit.se/power-plan/auth-api/src/db"
"gitlab.larvit.se/power-plan/auth-api/src/utils"
)
type AccountInput struct {
@@ -63,12 +63,14 @@ func (h Handlers) AccountCreate(c *fiber.Ctx) error {
newAccountID, uuidErr := uuid.NewRandom()
if uuidErr != nil {
h.Log.Fatal("Could not create new Uuid", "err", uuidErr.Error())
h.Log.Error("Could not create new Uuid", "err", uuidErr.Error())
return c.Status(500).JSON([]ResJSONError{{Error: "Could not create new account UUID"}})
}
hashedPwd, pwdErr := utils.HashPassword(accountInput.Password)
if pwdErr != nil {
h.Log.Fatal("Could not hash password", "err", pwdErr.Error())
h.Log.Error("Could not hash password", "err", pwdErr.Error())
return c.Status(500).JSON([]ResJSONError{{Error: "Could not hash password: \"" + pwdErr.Error() + "\""}})
}
createdAccount, err := h.Db.AccountCreate(db.AccountCreateInput{

View File

@@ -3,7 +3,7 @@ package handlers
import (
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"gitlab.larvit.se/power-plan/auth/src/db"
"gitlab.larvit.se/power-plan/auth-api/src/db"
)
// AccountUpdateFields godoc

View File

@@ -2,7 +2,7 @@ package handlers
import (
jwt "github.com/dgrijalva/jwt-go"
"gitlab.larvit.se/power-plan/auth/src/db"
"gitlab.larvit.se/power-plan/auth-api/src/db"
"go.uber.org/zap"
)