aboutsummaryrefslogtreecommitdiff
path: root/invoice/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'invoice/service.go')
-rw-r--r--invoice/service.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/invoice/service.go b/invoice/service.go
index 91e2707..91579c6 100644
--- a/invoice/service.go
+++ b/invoice/service.go
@@ -81,6 +81,21 @@ func getInvoices(invoices *[]Invoice, userId uint, isDraft bool) error {
return nil
}
+func getInvoiceItems(items *[]InvoiceItem, invoiceId uint) error {
+ res := db.Where("invoice_id = ?", invoiceId).Find(&items)
+
+ // TODO: handle potential errors
+ if res.Error != nil {
+ return res.Error
+ }
+
+ if res.RowsAffected == 0 {
+ return e.ErrEmptyResponse
+ }
+
+ return nil
+}
+
// TODO: route to only get the invouce's items
func (i *Invoice) upsert() error {