Update API

This commit is contained in:
2025-06-22 23:23:26 +07:00
parent b077ef9f06
commit 40705fbf3b
63 changed files with 1976 additions and 81 deletions
+14
View File
@@ -0,0 +1,14 @@
package models
import "time"
type Customer struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `json:"name"`
Address string `json:"address"`
Phone string `json:"phone"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+16
View File
@@ -0,0 +1,16 @@
package models
import "time"
type Invoice struct {
ID uint `gorm:"primaryKey" json:"id"`
SalesOrderID uint `json:"sales_order_id"`
InvoiceDate time.Time `json:"invoice_date"`
DueDate time.Time `json:"due_date"`
TotalAmount float64 `json:"total_amount"`
Status string `json:"status"` // contoh: unpaid, partial, paid
Note string `json:"note"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+15
View File
@@ -0,0 +1,15 @@
package models
import "time"
type InvoiceLine struct {
ID uint `gorm:"primaryKey" json:"id"`
InvoiceID uint `json:"invoice_id"`
ProductID uint `json:"product_id"`
Quantity float64 `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Subtotal float64 `json:"subtotal"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+15
View File
@@ -0,0 +1,15 @@
package models
import "time"
type Payment struct {
ID uint `gorm:"primaryKey" json:"id"`
InvoiceID uint `json:"invoice_id"`
Amount float64 `json:"amount"`
PaidAt time.Time `json:"paid_at"`
Method string `json:"method"` // contoh: cash, bank transfer, credit card
Note string `json:"note"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+19
View File
@@ -0,0 +1,19 @@
package models
import "time"
type SalesOrder struct {
ID uint `gorm:"primaryKey" json:"id"`
CustomerID uint `json:"customer_id"`
OrderDate time.Time `json:"order_date"`
Status string `json:"status"`
TotalAmount float64 `json:"total_amount"`
Note string `json:"note"`
PaymentTerms string `json:"payment_terms"`
DueDate time.Time `json:"due_date"`
DPAmount float64 `json:"dp_amount"`
DPPaid float64 `json:"dp_paid"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+15
View File
@@ -0,0 +1,15 @@
package models
import "time"
type SalesOrderItem struct {
ID uint `gorm:"primaryKey" json:"id"`
SalesOrderID uint `json:"sales_order_id"`
ProductID uint `json:"product_id"`
Quantity float64 `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Subtotal float64 `json:"subtotal"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}