aboutsummaryrefslogtreecommitdiff
path: root/invoice/invoice.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-10-09 21:07:20 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-10-09 21:07:20 +0530
commit1924bfca2439829253df3598481034e5c586e3e2 (patch)
tree6b82a091ae97e1980fe0ff3f3fb3eaa726a6d6ad /invoice/invoice.go
parentb643f7852f93f73843aa5f52f9b4545321713e10 (diff)
added route to add items to invoicev0.0.12
Diffstat (limited to 'invoice/invoice.go')
-rw-r--r--invoice/invoice.go13
1 files changed, 11 insertions, 2 deletions
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