2024-08-02 22:36:25 +02:00
|
|
|
package types
|
|
|
|
|
2024-08-12 17:31:07 +02:00
|
|
|
import "time"
|
|
|
|
|
2024-08-02 22:36:25 +02:00
|
|
|
// User struct for requests
|
|
|
|
type User struct {
|
|
|
|
Username string `json:"username" binding:"required" example:"testUser"`
|
|
|
|
Password string `json:"password" binding:"required" example:"strongPassLol"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// User Account
|
|
|
|
type Account struct {
|
2024-11-06 18:45:54 +01:00
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
Token string `json:"token" example:"Fvs-MnxiEs5dnqMp2mSDIJigPbiIUs6Snk1xxiqPmUc"`
|
|
|
|
Username string `json:"username" example:"testUser"`
|
2024-08-02 22:36:25 +02:00
|
|
|
}
|
|
|
|
|
2024-08-03 07:06:07 +02:00
|
|
|
type Message struct {
|
2024-11-10 07:23:28 +01:00
|
|
|
Info string `json:"info" example:"Success!"`
|
2024-08-03 07:06:07 +02:00
|
|
|
}
|
|
|
|
|
2024-08-02 22:36:25 +02:00
|
|
|
type ErrorResponse struct {
|
|
|
|
Message string `json:"message" example:"Error: you stink"`
|
|
|
|
}
|
2024-08-03 07:06:07 +02:00
|
|
|
|
|
|
|
type DbCard struct {
|
2024-08-03 08:53:22 +02:00
|
|
|
ID uint `json:"id" example:"1"`
|
2024-08-03 07:06:07 +02:00
|
|
|
Name string `json:"name" example:"CreditCard"`
|
2024-11-01 08:26:37 +01:00
|
|
|
Balance uint64 `json:"balance" example:"1000"`
|
2024-08-03 07:06:07 +02:00
|
|
|
HaveCreditLine bool `json:"have_credit_line" example:"true"`
|
|
|
|
CreditLine uint64 `json:"credit_line" example:"500000"`
|
|
|
|
}
|
2024-08-03 12:39:42 +02:00
|
|
|
|
|
|
|
type DbCategory struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
Name string `json:"name" example:"Moldova"`
|
|
|
|
// Parent is used as a infinite sub-category structure
|
|
|
|
// Can be 0
|
|
|
|
ParentID uint `json:"parent_id" example:"0"`
|
|
|
|
}
|
2024-08-12 17:31:07 +02:00
|
|
|
|
|
|
|
type DbDebt struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
CardID uint `json:"card_id" example:"1"`
|
|
|
|
Comment string `json:"comment" example:"pizza"`
|
|
|
|
Value uint64 `json:"value" example:"20000"`
|
|
|
|
IOwe bool `json:"i_owe" example:"true"`
|
|
|
|
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
|
|
|
DateEnd time.Time `json:"date_end" example:"29/12/2001 12:00"`
|
|
|
|
Finished bool `json:"finished" example:"false"`
|
|
|
|
}
|
2024-08-14 17:20:51 +02:00
|
|
|
|
|
|
|
type DbIncome struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
CardID uint `json:"card_id" example:"1"`
|
|
|
|
Comment string `json:"comment" example:"pizza"`
|
|
|
|
Value uint64 `json:"value" example:"20000"`
|
|
|
|
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
|
|
|
}
|
2024-10-29 11:27:26 +01:00
|
|
|
|
|
|
|
type DbType struct {
|
2024-10-31 09:07:48 +01:00
|
|
|
ID uint `json:"id" example:"1"`
|
2024-10-29 11:27:26 +01:00
|
|
|
Name string `json:"name" example:"Medicine"`
|
|
|
|
Comment string `json:"comment" example:""`
|
|
|
|
Color string `json:"color" example:"red"`
|
|
|
|
}
|
2024-11-04 16:53:38 +01:00
|
|
|
|
2024-11-06 18:44:52 +01:00
|
|
|
type Session struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
UserID uint `json:"user_id" example:"1"`
|
|
|
|
}
|
2024-11-16 10:42:43 +01:00
|
|
|
|
|
|
|
type DbExpense struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
CardID uint `json:"card_id" example:"1"`
|
|
|
|
TypeID uint `json:"type_id" example:"1"`
|
|
|
|
Value uint64 `json:"value" example:"20000"`
|
|
|
|
Comment string `json:"comment" example:"pizza"`
|
|
|
|
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
|
|
|
}
|
2024-11-16 19:31:25 +01:00
|
|
|
|
|
|
|
type DbTransfer struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
FromCardID uint `json:"from_card_id" example:"1"`
|
|
|
|
ToCardID uint `json:"to_card_id" example:"1"`
|
|
|
|
Value uint64 `json:"value" example:"20000"`
|
|
|
|
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
|
|
|
}
|
2024-11-18 08:52:11 +01:00
|
|
|
|
|
|
|
type DbItem struct {
|
|
|
|
ID uint `json:"id" example:"1"`
|
|
|
|
CategoryID uint `json:"category_id" example:"1"`
|
|
|
|
CurrentPriceID uint `json:"current_price_id" example:"1"`
|
|
|
|
TypeID uint `json:"type_id" example:"1"`
|
|
|
|
Name string `json:"name" example:"pizza"`
|
|
|
|
Comment string `json:"comment" example:"this is an item"`
|
|
|
|
MetricType uint8 `json:"metric_type" example:"0"`
|
|
|
|
MetricValue uint64 `json:"metric_value" example:"10000"`
|
|
|
|
Proteins uint64 `json:"proteins" example:"0"`
|
|
|
|
Carbs uint64 `json:"carbs" example:"0"`
|
|
|
|
Fats uint64 `json:"fats" example:"0"`
|
|
|
|
Price uint64 `json:"price" example:"10050"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DbItemSearch struct {
|
|
|
|
CategoryID uint `json:"category_id" example:"1"`
|
|
|
|
TypeID uint `json:"type_id" example:"1"`
|
|
|
|
}
|
2024-11-19 09:13:19 +01:00
|
|
|
|
|
|
|
type DbMetric struct {
|
|
|
|
Value uint8 `json:"value" example:"1"`
|
|
|
|
Name string `json:"name" example:"Kilogram"`
|
|
|
|
Short string `json:"short" example:"kg"`
|
|
|
|
}
|
2024-11-20 17:16:45 +01:00
|
|
|
|
|
|
|
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"`
|
|
|
|
}
|