Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edd980f4c1 | |||
| 2e64d106aa | |||
| cb2e0ac34e | |||
| 735f2d668c | |||
| 2f71ff408d | |||
| 0c99855748 | |||
| b63cf00c33 | |||
| e9d0fe8960 | |||
| 73ecb0aa7e | |||
| d614a907b5 | |||
| 597e72169a |
@@ -10,7 +10,7 @@ type GetBasketResponse struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
CreatedAt time.Duration `json:"created_at"`
|
CreatedAt time.Duration `json:"created_at"`
|
||||||
UpdatedAt time.Duration `json:"updated_at"`
|
UpdatedAt time.Duration `json:"updated_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetBasketItemsRequest struct {
|
type GetBasketItemsRequest struct {
|
||||||
@@ -23,7 +23,7 @@ type GetBasketItemsResponse struct {
|
|||||||
Quantity int `json:"quantity"`
|
Quantity int `json:"quantity"`
|
||||||
Price float64 `json:"price"`
|
Price float64 `json:"price"`
|
||||||
CreatedAt time.Duration `json:"created_at"`
|
CreatedAt time.Duration `json:"created_at"`
|
||||||
UpdatedAt time.Duration `json:"updated_at"`
|
UpdatedAt time.Duration `json:"updated_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BasketCheckoutRequest struct {
|
type BasketCheckoutRequest struct {
|
||||||
@@ -31,5 +31,5 @@ type BasketCheckoutRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BasketCheckoutResponse struct {
|
type BasketCheckoutResponse struct {
|
||||||
ID string `json:"order_id"`
|
ID string `json:"basket_id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type BasketModel struct {
|
type BasketModel struct {
|
||||||
ID string `db:"id"`
|
ID string `db:"id" json:"id"`
|
||||||
CreatedAt pgtype.Timestamp `db:"created_at"`
|
State string `db:"state" json:"state"`
|
||||||
UpdatedAt pgtype.Timestamp `db:"updated_at"`
|
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||||
|
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BasketItemModel struct {
|
type BasketItemModel struct {
|
||||||
ID string `db:"id"`
|
ID string `db:"id" json:"id"`
|
||||||
BasketID string `db:"basket_id"`
|
BasketID string `db:"basket_id" json:"basket_id"`
|
||||||
ProductID string `db:"product_id"`
|
ProductID int `db:"product_id" json:"product_id"`
|
||||||
Quantity int `db:"quantity"`
|
Quantity int `db:"quantity" json:"quantity"`
|
||||||
Price float64 `db:"price"`
|
Price float64 `db:"price" json:"price"`
|
||||||
CreatedAt pgtype.Timestamp `db:"created_at"`
|
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamp `db:"updated_at"`
|
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ type ProductModel struct {
|
|||||||
Name string `db:"name"`
|
Name string `db:"name"`
|
||||||
Price float64 `db:"price"`
|
Price float64 `db:"price"`
|
||||||
CreatedAt pgtype.Timestamp `db:"created_at"`
|
CreatedAt pgtype.Timestamp `db:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamp `db:"updated_at"`
|
UpdatedAt pgtype.Timestamp `db:"updated_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
20
model/order.go
Normal file
20
model/order.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "github.com/jackc/pgtype"
|
||||||
|
|
||||||
|
type OrderModel struct {
|
||||||
|
ID string `db:"id" json:"id"`
|
||||||
|
State string `db:"state" json:"state"`
|
||||||
|
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||||
|
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderItemModel struct {
|
||||||
|
ID string `db:"id" json:"id"`
|
||||||
|
OrderID string `db:"order_id" json:"order_id"`
|
||||||
|
ProductID int `db:"product_id" json:"product_id"`
|
||||||
|
Quantity int `db:"quantity" json:"quantity"`
|
||||||
|
Price float64 `db:"price" json:"price"`
|
||||||
|
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||||
|
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user