From 953394335b7d6f89c48436fd3403aec2c40a85c2 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 18:16:45 +0200 Subject: [PATCH] Remove DbPayment and add Payment instead to types package --- types/types.go | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/types/types.go b/types/types.go index 77f634b..3c59a3b 100644 --- a/types/types.go +++ b/types/types.go @@ -65,16 +65,6 @@ type DbType struct { Color string `json:"color" example:"red"` } -type DbPayment struct { - ID uint `json:"id" example:"1"` - CardID uint `json:"card_id" example:"1"` - CategoryID uint `json:"category_id" example:"1"` - Title string `json:"title" example:"Veggies"` - Descr string `json:"description" example:""` - Note string `json:"not" example:"I'm a teapot"` - Date time.Time `json:"date" example:"29/11/2001 12:00"` -} - type Session struct { ID string `json:"id"` UserID uint `json:"user_id" example:"1"` @@ -122,3 +112,28 @@ type DbMetric struct { Name string `json:"name" example:"Kilogram"` Short string `json:"short" example:"kg"` } + +type Payment struct { + ID uint `json:"id" example:"1"` + CardID uint `json:"card_id" example:"1"` + CategoryID uint `json:"category_id" example:"1"` + Title string `json:"title" example:"some title"` + Description string `json:"descr" example:"i bought some title for 20$"` + Note string `json:"note" example:"no i did not hit domain"` + Date time.Time `json:"date" example:"29/11/2001 12:00"` + Items []ItemBought `json:"items" example:"[]"` +} + +type ItemBought struct { + ID uint `json:"id" example:"1"` + NewName string `json:"new_name" example:"itemName"` + NewComment string `json:"new_comment" example:"itemName"` + ItemID uint `json:"item_id" example:"0"` + PaymentID uint `json:"payment_id" example:"1"` + TypeID uint `json:"type_id" example:"1"` + Price uint64 `json:"price" example:"1025"` + Quantity uint `json:"quantity" example:"2"` + TotalCost uint64 `json:"total_cost" example:"2050"` + MetricType uint8 `json:"metric_type" example:"0"` + MetricValue uint64 `json:"metric_value" example:"100"` +}