aboutsummaryrefslogtreecommitdiff
path: root/invoice/invoice.go
diff options
context:
space:
mode:
Diffstat (limited to 'invoice/invoice.go')
-rw-r--r--invoice/invoice.go16
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
}