feat: amount transaction and count of item

This commit is contained in:
ferdiansyah783
2024-07-27 16:47:33 +07:00
parent 4013b12ac9
commit 30aa206d80
9 changed files with 192 additions and 19 deletions
+42 -5
View File
@@ -18,6 +18,22 @@ type Order struct {
OrderItems []OrderItem `gorm:"foreignKey:OrderID;constraint:OnDelete:CASCADE;"`
}
type OrderDB struct {
Order
}
func (b *Order) ToOrderDB() *OrderDB {
return &OrderDB{
Order: *b,
}
}
func (e *OrderDB) ToSumAmount() *Order {
return &Order{
Amount: e.Amount,
}
}
type OrderResponse struct {
Order *Order
Token string
@@ -99,11 +115,12 @@ type HistoryOrderDB struct {
HistoryOrder
}
type HistoryOrderSearch struct {
PartnerID *int64
IsAdmin bool
Limit int
Offset int
type OrderSearch struct {
PartnerID *int64
IsAdmin bool
PaymentType string
Limit int
Offset int
}
type HistoryOrderList []*HistoryOrderDB
@@ -136,3 +153,23 @@ func (b *HistoryOrderList) ToHistoryOrderList() []*HistoryOrder {
}
return HistoryOrders
}
type TicketSold struct {
Count int64 `gorm:"type:int;column:count"`
}
type TicketSoldDB struct {
TicketSold
}
func (b *TicketSold) ToTicketSoldDB() *TicketSoldDB {
return &TicketSoldDB{
TicketSold: *b,
}
}
func (e *TicketSoldDB) ToTicketSold() *TicketSold {
return &TicketSold{
Count: e.Count,
}
}