Signed-off-by: Anirudh Oppiliappan anirudh@tangled.org
appview/db/db.go
appview/db/db.go
This file has not been changed.
+2
-12
appview/db/webhooks.go
+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
appview/models/webhook.go
This file has not been changed.
History
6 rounds
5 comments
anirudh.fi
submitted
#5
1 commit
expand
collapse
appview/{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
3/3 success
expand
collapse
expand 0 comments
pull request successfully merged
anirudh.fi
submitted
#4
1 commit
expand
collapse
appview/{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
3/3 success
expand
collapse
expand 0 comments
anirudh.fi
submitted
#3
1 commit
expand
collapse
appview/{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
3/3 success
expand
collapse
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...
anirudh.fi
submitted
#2
1 commit
expand
collapse
appview/{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
3/3 success
expand
collapse
anirudh.fi
submitted
#1
1 commit
expand
collapse
appview:{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
3/3 success
expand
collapse
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 stringwith more concrete variants
anirudh.fi
submitted
#0
1 commit
expand
collapse
appview:{db,models}: webhook tables and crud ops
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
@oppi.li, done.