aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-10 19:45:51 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-10 19:45:51 +0530
commit37fec5e9e7ef24c4f682bf5103b9d0bd6769ce8b (patch)
tree395cd9befca67ecdea5028a9442c3e9f28e21cc0
parent05268541100f11b3a0e089adcc1bbb591f4579de (diff)
using gorm full save associations to also save the billing addressHEADv0.13.2master
-rw-r--r--customer/service.go3
-rw-r--r--main.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/customer/service.go b/customer/service.go
index a79e466..77b4dfa 100644
--- a/customer/service.go
+++ b/customer/service.go
@@ -19,6 +19,7 @@ package customer
import (
e "vidhukant.com/openbills/errors"
+ "gorm.io/gorm"
)
func getCustomer(customer *Customer, id uint) error {
@@ -52,7 +53,7 @@ func getCustomers(customers *[]Customer, userId uint) error {
}
func (c *Customer) upsert() error {
- res := db.Save(c)
+ res := db.Session(&gorm.Session{FullSaveAssociations: true}).Save(&c)
// TODO: handle potential errors
return res.Error
}
diff --git a/main.go b/main.go
index 9ea1416..9da4fde 100644
--- a/main.go
+++ b/main.go
@@ -38,7 +38,7 @@ import (
"log"
)
-const OPENBILLS_VERSION = "v0.13.1"
+const OPENBILLS_VERSION = "v0.13.2"
func init() {
if !viper.GetBool("debug_mode") {