This commit is contained in:
Piotr Biernat 2022-12-18 20:51:26 +01:00
commit 40cc715898
11 changed files with 85 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# api-entities
API Entities.

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.pbiernat.dev/egommerce/api-entities
go 1.19

9
http/basket.go Normal file
View 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
View 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
View 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
View File

@ -0,0 +1,5 @@
package http
type HealthResponse struct {
Status string `json:"status,omitempty"`
}

10
http/identity.go Normal file
View 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
View File

@ -0,0 +1,8 @@
package http
type UpdateOrderStatusRequest struct {
Status string `json:"status"`
}
type UpdateOrderStatusResponse struct {
}

9
http/pricing.go Normal file
View 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
View 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
View File

@ -0,0 +1 @@
package definition