Skip to content

Commit 3610762

Browse files
committed
increase the limit of rwebhooks
1 parent 79ae901 commit 3610762

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

api/pkg/handlers/webhook_handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ func (h *WebhookHandler) Store(c *fiber.Ctx) error {
160160
return h.responseUnprocessableEntity(c, errors, "validation errors while storing webhook")
161161
}
162162

163-
webhooks, err := h.service.Index(ctx, h.userIDFomContext(c), repositories.IndexParams{Skip: 0, Limit: 3})
163+
webhooks, err := h.service.Index(ctx, h.userIDFomContext(c), repositories.IndexParams{Skip: 0, Limit: 10})
164164
if err != nil {
165165
ctxLogger.Error(stacktrace.Propagate(err, fmt.Sprintf("cannot index webhooks for user [%s]", h.userIDFomContext(c))))
166-
return h.responsePaymentRequired(c, "You can't create more than 1 webhook contact us to upgrade your account.")
166+
return h.responseInternalServerError(c)
167167
}
168168

169-
if len(webhooks) > 1 {
170-
ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] wants to create more than 2 webhooks", h.userIDFomContext(c))))
171-
return h.responsePaymentRequired(c, "You can't create more than 2 webhooks contact us to upgrade your account.")
169+
if len(webhooks) == 10 {
170+
ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] wants to create more than 5 webhooks", h.userIDFomContext(c))))
171+
return h.responsePaymentRequired(c, "You can't create more than 10 webhooks contact us to upgrade to our enterprise plan.")
172172
}
173173

174174
webhook, err := h.service.Store(ctx, request.ToStoreParams(h.userFromContext(c)))

api/pkg/services/webhook_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (service *WebhookService) Index(ctx context.Context, userID entities.UserID
6767
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg))
6868
}
6969

70-
ctxLogger.Info(fmt.Sprintf("fetched [%d] messages with prams [%+#v]", len(webhooks), params))
70+
ctxLogger.Info(fmt.Sprintf("fetched [%d] webhooks with prams [%+#v]", len(webhooks), params))
7171
return webhooks, nil
7272
}
7373

@@ -124,7 +124,7 @@ func (service *WebhookService) Store(ctx context.Context, params *WebhookStorePa
124124
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg))
125125
}
126126

127-
ctxLogger.Info(fmt.Sprintf("webhook saved with id [%s] in the [%T]", webhook.ID, service.repository))
127+
ctxLogger.Info(fmt.Sprintf("webhook saved with id [%s] for user [%s] in the [%T]", webhook.ID, webhook.UserID, service.repository))
128128
return webhook, nil
129129
}
130130

0 commit comments

Comments
 (0)