all repos — piggy @ 1a0ce761ef68d0800a69ebff7968d2c655aba6f3

Dead simple finance manager in Go, HTML and JS.

save record with associations
Marco Andronaco andronacomarco@gmail.com
Sun, 06 Oct 2024 14:59:45 +0200
commit

1a0ce761ef68d0800a69ebff7968d2c655aba6f3

parent

8707df94ac518748da0ec8f8d60b0a4208e3e7b9

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M src/api/api.gosrc/api/api.go

@@ -6,6 +6,7 @@ "log"

"net/http" "github.com/BiRabittoh/piggy/src/app" + "gorm.io/gorm" ) func getBookmakers(w http.ResponseWriter, r *http.Request) {

@@ -172,7 +173,7 @@ log.Println("could not decode record JSON: " + err.Error())

new400Error(w, err) return } - err = app.DB.Save(&record).Error + err = app.DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&record).Error if err != nil { log.Println("could not save record: " + err.Error()) new500Error(w, err)