From 37fec5e9e7ef24c4f682bf5103b9d0bd6769ce8b Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 10 Oct 2025 19:45:51 +0530 Subject: using gorm full save associations to also save the billing address --- customer/service.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'customer/service.go') 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 } -- cgit v1.2.3