Authorisation: @admin and @signedIn schema directives replace the 25 hand-copied resolver checks. A test fails if a mutation has neither and is not on the public allow-list, so a new mutation cannot ship unguarded. IDs: uint model IDs bind through graphql.UintID, removing the ten int(obj.ID) resolvers. Job status is a GraphQL enum, tied to services.statusOrder by a test. Input is strict, so the mutations no longer coerce an unknown status to "applied"; output is lenient so one legacy row cannot fail the list. deleteJobApplication and deleteJobAppReference now error on a missing id like the other deletes. The rowing reader, the job extractor and now the email classifier reach the Python service through one services.CallPython helper. The email pipeline's prompt and fence stripping moved to Python, and anthropic-sdk-go is gone from go.mod. Fix the auth test fixture, whose 11-byte secret had been panicking the services test package since InitAuth began requiring 32 bytes. Add a test that keeps the python service's compose environment list in step with the env registry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
38 lines
1.7 KiB
GraphQL
38 lines
1.7 KiB
GraphQL
# Root of the GraphQL schema.
|
|
#
|
|
# Query and Mutation are declared here with no fields; every other file in this
|
|
# directory adds to them with `extend type Query` / `extend type Mutation`.
|
|
# That is what lets the schema be split one file per domain, matching the
|
|
# one-file-per-domain resolver layout (gqlgen.yml uses layout: follow-schema).
|
|
#
|
|
# Time is mapped to Go's time.Time by gqlgen's default scalar handling and is
|
|
# serialised as RFC 3339.
|
|
#
|
|
# These files are the source of truth: after editing one, run
|
|
# go run github.com/99designs/gqlgen generate
|
|
# from backend/ to regenerate graph/generated.go and graph/model/models_gen.go.
|
|
# Note that `#` comments like this one are invisible to clients; a `"""` block
|
|
# would become a schema description and show up in introspection.
|
|
|
|
scalar Time
|
|
|
|
# Authorisation. There is no middleware in front of /graphql, so a field is
|
|
# PUBLIC unless it carries one of these. Each is implemented once, in
|
|
# graph/directives.go, and runs before the field's resolver:
|
|
#
|
|
# @admin the request must carry an admin's access token
|
|
# (error: "admin access required")
|
|
# @signedIn any valid access token will do
|
|
# (error: "authentication required")
|
|
#
|
|
# Every mutation needs one of them unless it is deliberately public (login,
|
|
# logout, refreshToken); graph/directives_test.go fails otherwise, and pins
|
|
# which queries are guarded. Rules that are not a plain gate stay in the
|
|
# resolver: a post is only editable by its author, `me` answers for whoever is
|
|
# signed in, and `messages` filters private rows rather than refusing.
|
|
directive @admin on FIELD_DEFINITION
|
|
directive @signedIn on FIELD_DEFINITION
|
|
|
|
type Query
|
|
type Mutation
|