diff --git a/server/integration/telegram.go b/server/integration/telegram.go index 830eb0b1..e4d41215 100644 --- a/server/integration/telegram.go +++ b/server/integration/telegram.go @@ -282,7 +282,7 @@ func (t *TelegramHandler) dispatchMemoRelatedWebhook(ctx context.Context, memo s for _, hook := range webhooks { payload := t.convertMemoToWebhookPayload(ctx, memo) payload.ActivityType = activityType - payload.URL = hook.Url + payload.URL = hook.URL err := webhook.Post(*payload) if err != nil { return errors.Wrap(err, "failed to post webhook") diff --git a/server/route/api/v2/memo_service.go b/server/route/api/v2/memo_service.go index 0d2ce538..ab29ab73 100644 --- a/server/route/api/v2/memo_service.go +++ b/server/route/api/v2/memo_service.go @@ -823,7 +823,7 @@ func (s *APIV2Service) dispatchMemoRelatedWebhook(ctx context.Context, memo *api return errors.Wrap(err, "failed to convert memo to webhook payload") } payload.ActivityType = activityType - payload.URL = hook.Url + payload.URL = hook.URL if err := webhook.Post(*payload); err != nil { return errors.Wrap(err, "failed to post webhook") } diff --git a/server/route/api/v2/webhook_service.go b/server/route/api/v2/webhook_service.go index ccfc8654..0cd0efa3 100644 --- a/server/route/api/v2/webhook_service.go +++ b/server/route/api/v2/webhook_service.go @@ -21,7 +21,7 @@ func (s *APIV2Service) CreateWebhook(ctx context.Context, request *apiv2pb.Creat webhook, err := s.Store.CreateWebhook(ctx, &store.Webhook{ CreatorID: currentUser.ID, Name: request.Name, - Url: request.Url, + URL: request.Url, }) if err != nil { return nil, status.Errorf(codes.Internal, "failed to create webhook, error: %+v", err) @@ -114,6 +114,6 @@ func convertWebhookFromStore(webhook *store.Webhook) *apiv2pb.Webhook { RowStatus: convertRowStatusFromStore(webhook.RowStatus), CreatorId: webhook.CreatorID, Name: webhook.Name, - Url: webhook.Url, + Url: webhook.URL, } } diff --git a/store/db/mysql/webhook.go b/store/db/mysql/webhook.go index 7ed650d1..5073d9af 100644 --- a/store/db/mysql/webhook.go +++ b/store/db/mysql/webhook.go @@ -10,7 +10,7 @@ import ( func (d *DB) CreateWebhook(ctx context.Context, create *store.Webhook) (*store.Webhook, error) { fields := []string{"`name`", "`url`", "`creator_id`"} placeholder := []string{"?", "?", "?"} - args := []any{create.Name, create.Url, create.CreatorID} + args := []any{create.Name, create.URL, create.CreatorID} stmt := "INSERT INTO `webhook` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")" result, err := d.db.ExecContext(ctx, stmt, args...) @@ -55,7 +55,7 @@ func (d *DB) ListWebhooks(ctx context.Context, find *store.FindWebhook) ([]*stor &rowStatus, &webhook.CreatorID, &webhook.Name, - &webhook.Url, + &webhook.URL, ); err != nil { return nil, err } diff --git a/store/db/postgres/webhook.go b/store/db/postgres/webhook.go index aefb43e6..522b24f4 100644 --- a/store/db/postgres/webhook.go +++ b/store/db/postgres/webhook.go @@ -9,7 +9,7 @@ import ( func (d *DB) CreateWebhook(ctx context.Context, create *store.Webhook) (*store.Webhook, error) { fields := []string{"name", "url", "creator_id"} - args := []any{create.Name, create.Url, create.CreatorID} + args := []any{create.Name, create.URL, create.CreatorID} stmt := "INSERT INTO webhook (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status" var rowStatus string if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -65,7 +65,7 @@ func (d *DB) ListWebhooks(ctx context.Context, find *store.FindWebhook) ([]*stor &rowStatus, &webhook.CreatorID, &webhook.Name, - &webhook.Url, + &webhook.URL, ); err != nil { return nil, err } @@ -103,7 +103,7 @@ func (d *DB) UpdateWebhook(ctx context.Context, update *store.UpdateWebhook) (*s &rowStatus, &webhook.CreatorID, &webhook.Name, - &webhook.Url, + &webhook.URL, ); err != nil { return nil, err } diff --git a/store/db/sqlite/webhook.go b/store/db/sqlite/webhook.go index 360d1912..742b3c72 100644 --- a/store/db/sqlite/webhook.go +++ b/store/db/sqlite/webhook.go @@ -10,7 +10,7 @@ import ( func (d *DB) CreateWebhook(ctx context.Context, create *store.Webhook) (*store.Webhook, error) { fields := []string{"`name`", "`url`", "`creator_id`"} placeholder := []string{"?", "?", "?"} - args := []any{create.Name, create.Url, create.CreatorID} + args := []any{create.Name, create.URL, create.CreatorID} stmt := "INSERT INTO `webhook` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" var rowStatus string if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -66,7 +66,7 @@ func (d *DB) ListWebhooks(ctx context.Context, find *store.FindWebhook) ([]*stor &rowStatus, &webhook.CreatorID, &webhook.Name, - &webhook.Url, + &webhook.URL, ); err != nil { return nil, err } @@ -104,7 +104,7 @@ func (d *DB) UpdateWebhook(ctx context.Context, update *store.UpdateWebhook) (*s &rowStatus, &webhook.CreatorID, &webhook.Name, - &webhook.Url, + &webhook.URL, ); err != nil { return nil, err } diff --git a/store/webhook.go b/store/webhook.go index 4236c2cc..d8b7f4eb 100644 --- a/store/webhook.go +++ b/store/webhook.go @@ -11,7 +11,7 @@ type Webhook struct { CreatorID int32 RowStatus RowStatus Name string - Url string + URL string } type FindWebhook struct { diff --git a/test/store/webhook_test.go b/test/store/webhook_test.go index 3b3a9394..8a7378ef 100644 --- a/test/store/webhook_test.go +++ b/test/store/webhook_test.go @@ -17,7 +17,7 @@ func TestWebhookStore(t *testing.T) { webhook, err := ts.CreateWebhook(ctx, &store.Webhook{ CreatorID: user.ID, Name: "test_webhook", - Url: "https://example.com", + URL: "https://example.com", RowStatus: store.Normal, }) require.NoError(t, err)