aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/customer/service.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-12 13:38:07 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-12 13:38:07 +0530
commitfd863aadf34b9837bd77587c1d36eb49000a8de7 (patch)
treec1ba13e609134451b8956b92f618d5e36c272839 /customer/service.go
parenta356803594ab36fa69e7dbcbd79261d8b46f4262 (diff)
moved shipping address and billing address to the customers table itselfHEADv0.20.0master
Diffstat (limited to 'customer/service.go')
-rw-r--r--customer/service.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/customer/service.go b/customer/service.go
index ca401f1..0286c3e 100644
--- a/customer/service.go
+++ b/customer/service.go
@@ -1,5 +1,5 @@
/* openbills - Server for web based Libre Billing Software
- * Copyright (C) 2023 Vidhu Kant Sharma <vidhukant@vidhukant.com>
+ * Copyright (C) 2023-2025 Vidhu Kant Sharma <vidhukant@vidhukant.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,11 +19,10 @@ package customer
import (
e "vidhukant.com/openbills/errors"
- "gorm.io/gorm"
)
func getCustomer(customer *Customer, id uint) error {
- res := db.Preload("BillingAddress").Preload("ShippingAddress").Find(&customer, id)
+ res := db.Find(&customer, id)
// TODO: handle potential errors
if res.Error != nil {
@@ -53,8 +52,7 @@ func getCustomers(customers *[]Customer) error {
}
func (c *Customer) upsert() error {
- db.Model(&c).Association("ShippingAddress").Replace(c.ShippingAddress)
- res := db.Session(&gorm.Session{FullSaveAssociations: true}).Save(&c)
+ res := db.Save(&c)
// TODO: handle potential errors
return res.Error
}