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/invoice.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'invoice/invoice.go') diff --git a/invoice/invoice.go b/invoice/invoice.go index 0f4a601..fa8bb08 100644 --- a/invoice/invoice.go +++ b/invoice/invoice.go @@ -22,6 +22,7 @@ import ( d "vidhukant.com/openbills/db" "vidhukant.com/openbills/user" c "vidhukant.com/openbills/customer" + i "vidhukant.com/openbills/item" "time" ) @@ -29,7 +30,7 @@ var db *gorm.DB func init() { db = d.DB - db.AutoMigrate(&Invoice{}, &InvoiceBillingAddress{}, &InvoiceShippingAddress{}) + db.AutoMigrate(&Invoice{}, &InvoiceItem{}, &InvoiceBillingAddress{}, &InvoiceShippingAddress{}) } type InvoiceBillingAddress struct { @@ -44,6 +45,14 @@ type InvoiceShippingAddress struct { InvoiceID uint } +type InvoiceItem struct { + gorm.Model + i.Item + InvoiceID uint + BrandName string + Quantity string // float +} + type Invoice struct { gorm.Model UserID uint `json:"-"` @@ -52,7 +61,7 @@ type Invoice struct { InvoiceNumber uint BillingAddress InvoiceBillingAddress ShippingAddress InvoiceShippingAddress - Draft bool + IsDraft bool // Transporter Transporter // DueDate string -- cgit v1.2.3