add new user and role table in app (in progress)
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m12s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m8s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m8s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 4m57s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m7s

This commit is contained in:
Adrian Zürcher
2025-10-14 16:41:20 +02:00
parent fdf56a4c0b
commit 690b7f4034
45 changed files with 1427 additions and 629 deletions

View File

@@ -3,7 +3,6 @@ package user
import (
"backend/dbRequest"
"backend/models"
"database/sql"
"encoding/json"
"fmt"
"io"
@@ -13,6 +12,10 @@ import (
)
func (um *UserManager) UpdateSettings(c *gin.Context) {
if !um.databaseOpened(c) {
return
}
body, err := io.ReadAll(c.Request.Body)
if err != nil {
c.JSON(http.StatusBadRequest, models.NewJsonErrorResponse(err))
@@ -26,19 +29,13 @@ func (um *UserManager) UpdateSettings(c *gin.Context) {
return
}
db, err := sql.Open(um.dbType, um.dbFile)
if dbRequest.CheckDBError(c, user.Name, err) {
return
}
defer db.Close()
jsonBytes, err := json.Marshal(user.Settings)
if err != nil {
c.JSON(http.StatusOK, models.NewJsonErrorMessageResponse(err.Error()))
return
}
if _, err := db.Exec(dbRequest.DBUpdateSettings, string(jsonBytes), user.Name); err != nil {
if _, err := um.database.Exec(dbRequest.DBUpdateSettings, string(jsonBytes), user.Name); err != nil {
c.JSON(http.StatusBadRequest, models.NewJsonErrorResponse(err))
return
}