8374a1ef
feat(graph): GraphQL-native webhook surface (Phase 5a)
The webhook types, mutations, and resolvers, adapted from the pages.sr.ht core-go template for spec's single-owner model. - SDL: WebhookEvent (PROPOSAL_OPENED/MERGED/REJECTED), WebhookSubscription interface + UserWebhookSubscription, WebhookDelivery, WebhookPayload interface + ProposalEvent (carries a Proposal), cursor wrappers, `webhook` payload root field, and a `type Mutation` with createUserWebhook / deleteUserWebhook. No OAuth `client` field and no @access/@private directives — spec has no OAuth clients or scopes, so the owner gate is the entire ACL. - Models: hand-written database.Model impls (UserWebhookSubscription, WebhookDelivery) so gqlgen autobinds rather than generates them; events via pq.Array; cursor keyset pagination. - Resolvers: all owner-gated via authn (spec's ACL), using core-go's webhook engine — Validate, NewAuthConfig (INTERNAL, via the coreauth bridge), FilterWebhooks, WebhookContext.Exec for the sample, and the `webhook`→Payload(ctx) root. Proposal writes deliberately stay off this surface (only webhook mutations; the schema test now asserts exactly that). - gqlgen.yml binds Cursor to core-go's model.Cursor; generated code regenerated with the pinned gqlgen v0.17.36 (reproducible). Compiles and vets clean; existing graph read tests still pass. Runtime context wiring and event firing are the next slices.
Eugene Blikh <bigbes@gmail.com> — 2026-07-24 08:43:55 UTC
Commit 8374a1ef0826d0422d3db4685cfea15842c2096d —
view raw patch
Parent(s):
64e4ac89
| File | Status | + | − |
|---|---|---|---|
go.mod
|
M | +4 | -2 |
go.sum
|
M | +36 | -82 |
graph/api/generated.go
|
M | +2642 | -9 |
graph/gqlgen.yml
|
M | +8 | |
graph/graph_test.go
|
M | +28 | -9 |
graph/model/models_gen.go
|
M | +94 | |
graph/model/webhooks.go
|
A | +249 | |
graph/schema.graphqls
|
M | +149 | |
graph/schema.resolvers.go
|
M | +341 |