generated from PenaSide/GolangTemplate
fix interface impliment and add emty req to codeword rpc svc
This commit is contained in:
parent
b735df0e5b
commit
ddda50045b
@ -6,6 +6,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"log"
|
||||
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/errors"
|
||||
codeword_rpc "penahub.gitlab.yandexcloud.net/pena-services/customer/internal/proto/codeword"
|
||||
@ -51,9 +52,9 @@ func (receiver *CodewordClient) GetAllPromoActivations(ctx context.Context) (*co
|
||||
|
||||
client := codeword_rpc.NewPromoCodeServiceClient(connection)
|
||||
|
||||
response, err := client.GetAllPromoActivations(ctx)
|
||||
response, err := client.GetAllPromoActivations(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
receiver.logger.Error("failed getting stats resp on <GetAllPromoActivations> of <DiscountClient>", zap.Error(err), zap.Any("request", request))
|
||||
receiver.logger.Error("failed getting stats resp on <GetAllPromoActivations> of <DiscountClient>", zap.Error(err))
|
||||
return nil, errors.New(fmt.Errorf("failed getting stats resp from codeword: %w", err), errors.ErrInternalError)
|
||||
}
|
||||
|
||||
|
@ -889,16 +889,21 @@ func (api *API2) QuizLogoStat(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
func (api *API2) PromoCodeLtvStat(ctx echo.Context) error {
|
||||
func (api *API2) PromocodeLTV(ctx echo.Context) error {
|
||||
var req PromocodeLTVJSONRequestBody
|
||||
if err := ctx.Bind(&req); err != nil {
|
||||
api.logger.Error("failed to bind request", zap.Error(err))
|
||||
return api.error(ctx, http.StatusBadRequest, "failed to bind request")
|
||||
}
|
||||
|
||||
// получили данные из кодворда все активации промокодов какие есть
|
||||
codewordData, err := api.clients.codeword.GetAllPromoActivations(ctx.Request().Context())
|
||||
|
||||
if err != nil {
|
||||
return api.error(ctx, http.StatusInternalServerError, fmt.Sprint("failed getting codeword data", err.Error()))
|
||||
}
|
||||
|
||||
//todo
|
||||
|
||||
return ctx.JSON(http.StatusOK, codewordData)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user