fix: refs for db provider and few utils
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// GetPagination helps getting pagination data from paginated input
|
||||
// also returns default limit and offset if pagination data is not present
|
||||
func GetPagination(paginatedInput *model.PaginatedInput) model.Pagination {
|
||||
func GetPagination(paginatedInput *model.PaginatedInput) *model.Pagination {
|
||||
limit := int64(constants.DefaultLimit)
|
||||
page := int64(1)
|
||||
|
||||
@@ -21,7 +21,7 @@ func GetPagination(paginatedInput *model.PaginatedInput) model.Pagination {
|
||||
}
|
||||
}
|
||||
|
||||
return model.Pagination{
|
||||
return &model.Pagination{
|
||||
Limit: limit,
|
||||
Offset: (page - 1) * limit,
|
||||
Page: page,
|
||||
|
@@ -18,10 +18,10 @@ import (
|
||||
|
||||
// RegisterEvent util to register event
|
||||
// TODO change user to user ref
|
||||
func RegisterEvent(ctx context.Context, eventName string, authRecipe string, user models.User) error {
|
||||
func RegisterEvent(ctx context.Context, eventName string, authRecipe string, user *models.User) error {
|
||||
webhooks, err := db.Provider.GetWebhookByEventName(ctx, eventName)
|
||||
if err != nil {
|
||||
log.Debug("Error getting webhook: %v", err)
|
||||
log.Debug("error getting webhook: %v", err)
|
||||
return err
|
||||
}
|
||||
for _, webhook := range webhooks {
|
||||
@@ -63,7 +63,7 @@ func RegisterEvent(ctx context.Context, eventName string, authRecipe string, use
|
||||
continue
|
||||
}
|
||||
if envKey == constants.TestEnv {
|
||||
_, err := db.Provider.AddWebhookLog(ctx, models.WebhookLog{
|
||||
_, err := db.Provider.AddWebhookLog(ctx, &models.WebhookLog{
|
||||
HttpStatus: 200,
|
||||
Request: string(requestBody),
|
||||
Response: string(`{"message": "test"}`),
|
||||
@@ -104,7 +104,7 @@ func RegisterEvent(ctx context.Context, eventName string, authRecipe string, use
|
||||
}
|
||||
|
||||
statusCode := int64(resp.StatusCode)
|
||||
_, err = db.Provider.AddWebhookLog(ctx, models.WebhookLog{
|
||||
_, err = db.Provider.AddWebhookLog(ctx, &models.WebhookLog{
|
||||
HttpStatus: statusCode,
|
||||
Request: string(requestBody),
|
||||
Response: string(responseBytes),
|
||||
|
Reference in New Issue
Block a user