Skip to content

Define GraphQL Schema & Types #44

Description

@0xdevcollins

Define GraphQL schema matching existing REST API structure.

Tasks:

  • Create schema.graphql with Bounty, Project, User types
  • Define queries matching REST endpoints from lib/api/bounties.ts
  • Define mutations for create/update/delete operations
  • Add pagination types (replacing lib/api/types.ts:4-13)
  • Setup subscriptions for real-time updates (replacing WebSocket events from lib/socket/client.ts)
# schema.graphql
type Bounty {
  id: ID!
  type: BountyType!
  projectId: String!
  projectName: String!
  projectLogoUrl: String
  issueTitle: String!
  issueNumber: Int!
  githubRepo: String!
  githubIssueUrl: String!
  description: String!
  rewardAmount: Float
  rewardCurrency: String!
  difficulty: DifficultyLevel
  tags: [String!]!
  status: BountyStatus!
  createdAt: String!
  updatedAt: String!
}

type BountyConnection {
  edges: [BountyEdge!]!
  pageInfo: PageInfo!
  totalCount: Int!
}

type Query {
  bounties(
    page: Int
    limit: Int
    status: BountyStatus
    difficulty: DifficultyLevel
    search: String
  ): BountyConnection!
  
  bounty(id: ID!): Bounty
}

type Mutation {
  createBounty(input: CreateBountyInput!): Bounty!
  updateBounty(id: ID!, input: UpdateBountyInput!): Bounty!
  deleteBounty(id: ID!): Boolean!
  claimBounty(id: ID!): Bounty!
}

type Subscription {
  bountyCreated: Bounty!
  bountyUpdated: Bounty!
  bountyDeleted: ID!
}

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions