Monorepo for Tangled tangled.org

appview:{db,models}: webhook tables and crud ops #1066

merged opened by anirudh.fi targeting master from icy/qlyxxp
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:hwevmowznbiukdf6uk5dwrrq/sh.tangled.repo.pull/3menyebs7l722
+2 -12
Interdiff #4 #5
appview/db/db.go

This file has not been changed.

+2 -12
appview/db/webhooks.go
··· 118 118 active = 1 119 119 } 120 120 121 - secret := sql.NullString{ 122 - String: webhook.Secret, 123 - Valid: webhook.Secret != "", 124 - } 125 - 126 121 result, err := e.Exec(` 127 122 insert into webhooks (repo_at, url, secret, active, events) 128 123 values (?, ?, ?, ?, ?) 129 - `, webhook.RepoAt.String(), webhook.Url, secret, active, eventsStr) 124 + `, webhook.RepoAt.String(), webhook.Url, webhook.Secret, active, eventsStr) 130 125 131 126 if err != nil { 132 127 return fmt.Errorf("failed to insert webhook: %w", err) ··· 149 144 active = 1 150 145 } 151 146 152 - secret := sql.NullString{ 153 - String: webhook.Secret, 154 - Valid: webhook.Secret != "", 155 - } 156 - 157 147 _, err := e.Exec(` 158 148 update webhooks 159 149 set url = ?, secret = ?, active = ?, events = ?, updated_at = strftime('%Y-%m-%dT%H:%M:%SZ', 'now') 160 150 where id = ? 161 - `, webhook.Url, secret, active, eventsStr, webhook.Id) 151 + `, webhook.Url, webhook.Secret, active, eventsStr, webhook.Id) 162 152 163 153 if err != nil { 164 154 return fmt.Errorf("failed to update webhook: %w", err)
appview/models/webhook.go

This file has not been changed.

History

6 rounds 5 comments
sign up or login to add to the discussion
1 commit
expand
appview/{db,models}: webhook tables and crud ops
3/3 success
expand
expand 0 comments
pull request successfully merged
1 commit
expand
appview/{db,models}: webhook tables and crud ops
3/3 success
expand
expand 0 comments
1 commit
expand
appview/{db,models}: webhook tables and crud ops
3/3 success
expand
expand 3 comments

the db code needs to be updated accordingly to handle null strings, by reading into a sql.Null[string] and checking for s.Valid.

Oh, right...

1 commit
expand
appview/{db,models}: webhook tables and crud ops
3/3 success
expand
expand 1 comment
  • here: we should make the secret nullable in the db, since we no longer sign if secret is not supplied
1 commit
expand
appview:{db,models}: webhook tables and crud ops
3/3 success
expand
expand 1 comment
  • we dont need this index
  • would be nice to make [this] more strongly typed, we could have an enum for this, like type WebhookEvent string with more concrete variants
1 commit
expand
appview:{db,models}: webhook tables and crud ops
3/3 success
expand
expand 0 comments