diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2024-07-09 07:58:34 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2024-07-09 07:58:34 +0530 |
commit | d0a44ff5cfad5d063929426e2420f6f0d55b1dbe (patch) | |
tree | 476ad4ff14e39bed40049b4d1cba296c6d395c1b /invoice/invoice.go | |
parent | 908fb4b2b0fd1c31aa8c1cc87f56d490b42aca7a (diff) |
added custom fields supportv0.9.0
Diffstat (limited to 'invoice/invoice.go')
-rw-r--r-- | invoice/invoice.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/invoice/invoice.go b/invoice/invoice.go index 4b93ee4..4397710 100644 --- a/invoice/invoice.go +++ b/invoice/invoice.go @@ -30,7 +30,7 @@ var db *gorm.DB func init() { db = d.DB - db.AutoMigrate(&Invoice{}, &InvoiceItem{}, &InvoiceBillingAddress{}, &InvoiceShippingAddress{}) + db.AutoMigrate(&Invoice{}, &InvoiceItem{}, &InvoiceBillingAddress{}, &InvoiceShippingAddress{}, &CustomField{}) } type InvoiceBillingAddress struct { @@ -46,13 +46,21 @@ type InvoiceShippingAddress struct { } type InvoiceItem struct { - gorm.Model i.Item + ID uint InvoiceID uint BrandName string Quantity string // float } +// user can add as many custom fields as they like +type CustomField struct { + ID uint + InvoiceID uint + Key string + Value string +} + type Invoice struct { gorm.Model UserID uint `json:"-"` @@ -64,6 +72,7 @@ type Invoice struct { IsDraft bool Note string Items []InvoiceItem + CustomFields []CustomField // issuer and customer details are stored here // because they are NOT intended to ever change @@ -80,7 +89,4 @@ type Invoice struct { CustomerPhone string CustomerEmail string CustomerWebsite string - - // Transporter Transporter - // TransactionID string } |