From 1924bfca2439829253df3598481034e5c586e3e2 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 9 Oct 2023 21:07:20 +0530 Subject: added route to add items to invoice --- invoice/service.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'invoice/service.go') diff --git a/invoice/service.go b/invoice/service.go index 6b59949..cfb873f 100644 --- a/invoice/service.go +++ b/invoice/service.go @@ -51,6 +51,8 @@ func getInvoices(invoices *[]Invoice, userId uint) error { return nil } +// TODO: route to only get the invouce's items + func (i *Invoice) upsert() error { res := db.Save(i) // TODO: handle potential errors @@ -72,3 +74,9 @@ func (i *Invoice) del() error { return nil } + +func (i *InvoiceItem) upsert() error { + res := db.Save(i) + // TODO: handle potential errors + return res.Error +} -- cgit v1.2.3