Skip to content

Write GraphQL operation documents (queries & mutations) #99

Description

@0xdevcollins

Depends on: #98
Today, no .graphql operation documents exist. The codegen found no documents to process, so generated.ts only contains types, not hooks. We need to write the actual query and mutation documents so the codegen can produce usable React Query hooks.

Tasks

Create lib/graphql/operations/ with the following files:

  • bounty-queries.graphql
    query Bounties($query: BountyQueryInput) { bounties(query: $query) { ... } }
    query Bounty($id: ID!) { bounty(id: $id) { ... } }
    query ActiveBounties { activeBounties { ... } }
    query OrganizationBounties($organizationId: ID!) { organizationBounties(organizationId: $organizationId) { ... } }
    query ProjectBounties($projectId: ID!) { projectBounties(projectId: $projectId) { ... } }
  • bounty-mutations.graphql
    mutation CreateBounty($input: CreateBountyInput!) { createBounty(input: $input) { ... } }
    mutation UpdateBounty($input: UpdateBountyInput!) { updateBounty(input: $input) { ... } }
    mutation DeleteBounty($id: ID!) { deleteBounty(id: $id) }
  • submission-mutations.graphql
    mutation SubmitToBounty($input: CreateSubmissionInput!) { submitToBounty(input: $input) { ... } }
    mutation ReviewSubmission($input: ReviewSubmissionInput!) { reviewSubmission(input: $input) { ... } }
    mutation MarkSubmissionPaid($submissionId: ID!, $transactionHash: String!) { markSubmissionPaid(submissionId: $submissionId, transactionHash: $transactionHash) { ... } }
  • Define shared fragments for BountyFields, SubmissionFields to avoid field duplication
  • Run npm run codegen → verify hooks like useBountiesQuery, useCreateBountyMutation are generated

Acceptance Criteria

  • generated.ts exports typed React Query hooks for every query and mutation
  • Each generated hook uses the custom fetcher from lib/graphql/client.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions