aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/invoice/service.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-13 00:37:30 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-13 00:37:30 +0530
commitfb9ba155438100f295fdb563ad955151ee038ad3 (patch)
tree558c27ce3910a2aa2e7d18803b7548f6e7f6a032 /invoice/service.go
parent327a32f563394f92313e4a751515d69d90f4e7f5 (diff)
flattened out the invoice schema, was overengineered
Diffstat (limited to 'invoice/service.go')
-rw-r--r--invoice/service.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/invoice/service.go b/invoice/service.go
index 55b1319..20cf767 100644
--- a/invoice/service.go
+++ b/invoice/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
@@ -47,7 +47,7 @@ func getNewInvoiceNumber() (uint, error) {
}
func getInvoice(invoice *Invoice, id uint) error {
- res := db.Preload("BillingAddress").Preload("ShippingAddress").Preload("Items").Preload("CustomFields").Find(&invoice, id)
+ res := db.Preload("Items").Preload("CustomFields").Find(&invoice, id)
// TODO: handle potential errors
if res.Error != nil {
@@ -61,6 +61,8 @@ func getInvoice(invoice *Invoice, id uint) error {
return nil
}
+// TODO: rather than returning all invoices, always require a filter, maybe
+// so we're actually searching invoices
func getInvoices(invoices *[]Invoice, isDraft bool) error {
res := db.Where("is_draft = ?", isDraft).Find(&invoices)