Skip to content

Commit

Permalink
add and get product
Browse files Browse the repository at this point in the history
  • Loading branch information
KranjQ committed Dec 15, 2024
1 parent 56f52a3 commit 0a92d3a
Show file tree
Hide file tree
Showing 17 changed files with 1,854 additions and 542 deletions.
14 changes: 12 additions & 2 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ import (
metricsmiddleware "github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/middleware/httpMetricsMiddleware"
grpcpayments "github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/grpc/gen"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/acceptpayment"
addproduct "github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/addProduct"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/buyproduct"
getproducts "github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/getProducts"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/getbalance"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/payments/delivery/http/topUpBalance"
grpcpersonalities "github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/personalities/delivery/grpc/gen"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/personalities/delivery/http/getcurrentprofile"
"github.com/go-park-mail-ru/2024_2_SaraFun/internal/pkg/personalities/delivery/http/getprofile"
Expand Down Expand Up @@ -213,8 +216,11 @@ func main() {
updateQuestion := updatequestion.NewHandler(authClient, surveyClient, logger)
getQuestions := getquestions.NewHandler(authClient, surveyClient, logger)
getBalance := getbalance.NewHandler(authClient, paymentsClient, logger)
buyProduct := buyproduct.NewHandler(authClient, logger)
topupBalance := topUpBalance.NewHandler(authClient, logger)
buyProduct := buyproduct.NewHandler(authClient, paymentsClient, logger)
acceptPayment := acceptpayment.NewHandler(authClient, paymentsClient, logger)
addProduct := addproduct.NewHandler(authClient, paymentsClient, logger)
getProducts := getproducts.NewHandler(authClient, paymentsClient, logger)
authMiddleware := authcheck.New(authClient, logger)
accessLogMiddleware := middleware.NewAccessLogMiddleware(sugar)
metricsMiddleware := metricsmiddleware.NewMiddleware(_metrics, logger)
Expand Down Expand Up @@ -287,8 +293,12 @@ func main() {
payments := router.PathPrefix("/payments").Subrouter()
{
payments.Handle("/balance", http.HandlerFunc(getBalance.Handle)).Methods("GET", http.MethodOptions)
payments.Handle("/buy", http.HandlerFunc(buyProduct.Handle)).Methods("POST", http.MethodOptions)
payments.Handle("/topup", http.HandlerFunc(topupBalance.Handle)).Methods("POST", http.MethodOptions)
payments.Handle("/check", http.HandlerFunc(acceptPayment.Handle)).Methods("POST", http.MethodOptions)
payments.Handle("/buy", http.HandlerFunc(buyProduct.Handle)).Methods("POST", http.MethodOptions)
payments.Handle("/product", http.HandlerFunc(addProduct.Handle)).Methods("POST", http.MethodOptions)
payments.Handle("/products", http.HandlerFunc(getProducts.Handle)).Methods("GET", http.MethodOptions)

}

// Создаем HTTP-сервер
Expand Down
8 changes: 4 additions & 4 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ DB_USER=app_user
DB_PASSWORD=test
DB_NAME=sparkitDB
DB_SSLMODE=disable
SERVER_CERT_PATH=/etc/letsencrypt/live/spark-it.site/fullchain.pem
SERVER_KEY_PATH=/etc/letsencrypt/live/spark-it.site/privkey.pem
# SERVER_CERT_PATH=/etc/letsencrypt/live/spark-it.site/fullchain.pem
# SERVER_KEY_PATH=/etc/letsencrypt/live/spark-it.site/privkey.pem
SHOP_ID=999343
SECRET_SHOP_KEY=test_tg4qykklfcjLeOx-oMnv0jBUTKu6Cr7-FVqkG1-O1IY
# SERVER_CERT_PATH=../server.crt
# SERVER_KEY_PATH=../server.key
SERVER_CERT_PATH=../server.crt
SERVER_KEY_PATH=../server.key

135 changes: 111 additions & 24 deletions internal/models/user_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a92d3a

Please sign in to comment.