Init
This commit is contained in:
commit
40cc715898
3
go.mod
Normal file
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module git.pbiernat.dev/egommerce/api-entities
|
||||||
|
|
||||||
|
go 1.19
|
9
http/basket.go
Normal file
9
http/basket.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type BasketCheckoutRequest struct {
|
||||||
|
BasketID string `json:"basket_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BasketCheckoutResponse struct {
|
||||||
|
ID string `json:"order_id"`
|
||||||
|
}
|
17
http/catalog.go
Normal file
17
http/catalog.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type AddProductToBasketRequest struct {
|
||||||
|
ProductID int `json:"product_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductAddToBasketResponse struct {
|
||||||
|
BasketID string `json:"basket_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RemoveProductFromBasketRequest struct {
|
||||||
|
ProductID int `json:"product_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RemoveProductFromBasketResponse struct {
|
||||||
|
BasketID string `json:"basket_id"`
|
||||||
|
}
|
9
http/error.go
Normal file
9
http/error.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type ErrorResponse struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Error(err string) *ErrorResponse {
|
||||||
|
return &ErrorResponse{err}
|
||||||
|
}
|
5
http/health.go
Normal file
5
http/health.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type HealthResponse struct {
|
||||||
|
Status string `json:"status,omitempty"`
|
||||||
|
}
|
10
http/identity.go
Normal file
10
http/identity.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type AuthLoginRequest struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthLoginResponse struct {
|
||||||
|
Token string `json:"jwt_token"`
|
||||||
|
}
|
8
http/order.go
Normal file
8
http/order.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type UpdateOrderStatusRequest struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateOrderStatusResponse struct {
|
||||||
|
}
|
9
http/pricing.go
Normal file
9
http/pricing.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package http
|
||||||
|
|
||||||
|
type ProductPriceRequest struct {
|
||||||
|
ProductId int `json:"product_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductPriceResponse struct {
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
}
|
11
model/basket.go
Normal file
11
model/basket.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package definition
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jackc/pgtype"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BasketModel struct {
|
||||||
|
ID string `db:"id"`
|
||||||
|
CreatedAt pgtype.Timestamp `db:"created_at"`
|
||||||
|
UpdatedAt pgtype.Timestamp `db:"updated_at"`
|
||||||
|
}
|
1
model/pricing.go
Normal file
1
model/pricing.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package definition
|
Loading…
Reference in New Issue
Block a user