diff options
Diffstat (limited to 'customer/service.go')
| -rw-r--r-- | customer/service.go | 8 | 
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  }  |