Files
billit/internal/models/models.go
2025-12-06 15:31:18 +05:30

47 lines
1.9 KiB
Go

package models
// Product represents a product in the database
type Product struct {
SKU string `json:"sku"`
Name string `json:"name"`
HSNCode string `json:"hsn_code"`
BasePrice float64 `json:"base_price"`
WholesalePrice float64 `json:"wholesale_price"`
GSTRate float64 `json:"gst_rate"`
SmallOrderQty int `json:"small_order_qty"`
SmallOrderFee float64 `json:"small_order_fee"` // Convenience fee for orders below SmallOrderQty
Unit string `json:"unit"` // Unit of measurement (e.g., "pcs", "kg", "box")
UserID string `json:"user_id"`
CreatedAt string `json:"created_at"`
}
// Invoice represents a stored invoice
type Invoice struct {
ID string `json:"id"` // UUID
HumanReadableID string `json:"human_readable_id"` // Formatted ID like INV/12-2025/001
Data string `json:"data"` // JSON blob of invoice details
UserID string `json:"user_id"`
CreatedAt string `json:"created_at"`
}
// User represents an authenticated user
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Password string `json:"-"`
CompanyDetails string `json:"company_details"` // Multiline company details for invoice header
BankDetails string `json:"bank_details"` // Multiline bank details for invoice footer
InvoicePrefix string `json:"invoice_prefix"` // Prefix for invoice IDs (e.g., INV, BILL)
InvoiceCounter int `json:"invoice_counter"` // Auto-incrementing counter for invoice serial numbers
CreatedAt string `json:"created_at"`
}
// BuyerDetails represents a buyer/customer for invoices
type BuyerDetails struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"` // Display name for selection
Details string `json:"details"` // Multiline buyer details
CreatedAt string `json:"created_at"`
}