mirror of
https://github.com/usememos/memos.git
synced 2024-12-24 22:23:01 +08:00
chore: update var-naming
This commit is contained in:
parent
49f8cfd5d1
commit
9a2c423435
8 changed files with 14 additions and 14 deletions
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ type Webhook struct {
|
|||
CreatorID int32
|
||||
RowStatus RowStatus
|
||||
Name string
|
||||
Url string
|
||||
URL string
|
||||
}
|
||||
|
||||
type FindWebhook struct {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue