generated from PenaSide/GolangTemplate
remove req body from rpc codeword
This commit is contained in:
parent
cd691c882d
commit
a4b157188c
@ -4,13 +4,15 @@ package codeword;
|
|||||||
|
|
||||||
option go_package = "./codeword_rpc";
|
option go_package = "./codeword_rpc";
|
||||||
|
|
||||||
|
import "google/protobuf/empty.proto";
|
||||||
|
|
||||||
message Time {
|
message Time {
|
||||||
int64 from = 1;
|
int64 from = 1;
|
||||||
int64 to = 2;
|
int64 to = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
service PromoCodeService {
|
service PromoCodeService {
|
||||||
rpc GetAllPromoActivations(Time) returns (PromoActivationResp);
|
rpc GetAllPromoActivations(google.protobuf.Empty) returns (PromoActivationResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
message PromoActivationResp {
|
message PromoActivationResp {
|
||||||
|
@ -37,7 +37,7 @@ func NewCodewordClient(deps CodewordClientDeps) *CodewordClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (receiver *CodewordClient) GetAllPromoActivations(ctx context.Context, request *codeword_rpc.Time) (*codeword_rpc.PromoActivationResp, errors.Error) {
|
func (receiver *CodewordClient) GetAllPromoActivations(ctx context.Context) (*codeword_rpc.PromoActivationResp, errors.Error) {
|
||||||
connection, err := grpc.Dial(receiver.codewordServiceHost, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
connection, err := grpc.Dial(receiver.codewordServiceHost, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
receiver.logger.Error("failed to connect on <GetAllPromoActivations> of <CodewordClient>", zap.Error(err), zap.String("codeword host", receiver.codewordServiceHost))
|
receiver.logger.Error("failed to connect on <GetAllPromoActivations> of <CodewordClient>", zap.Error(err), zap.String("codeword host", receiver.codewordServiceHost))
|
||||||
@ -51,7 +51,7 @@ func (receiver *CodewordClient) GetAllPromoActivations(ctx context.Context, requ
|
|||||||
|
|
||||||
client := codeword_rpc.NewPromoCodeServiceClient(connection)
|
client := codeword_rpc.NewPromoCodeServiceClient(connection)
|
||||||
|
|
||||||
response, err := client.GetAllPromoActivations(ctx, request)
|
response, err := client.GetAllPromoActivations(ctx)
|
||||||
if err != nil {
|
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), zap.Any("request", request))
|
||||||
return nil, errors.New(fmt.Errorf("failed getting stats resp from codeword: %w", err), errors.ErrInternalError)
|
return nil, errors.New(fmt.Errorf("failed getting stats resp from codeword: %w", err), errors.ErrInternalError)
|
||||||
|
@ -888,3 +888,17 @@ func (api *API2) QuizLogoStat(ctx echo.Context) error {
|
|||||||
|
|
||||||
return ctx.JSON(http.StatusOK, result)
|
return ctx.JSON(http.StatusOK, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *API2) PromoCodeLtvStat(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()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user