---
id: w1/m11.5/t001
title: GraphQL codegen for custom-domain queries and mutations
worker: worker1
status: done
estimate: 20m
depends_on: []
---

## Objective

Add the `.graphql` operation files for the three custom-domain operations bex-api
exposes, then run `yarn codegen` to generate typed Apollo hooks for the dashboard.

## Context

- bex-api GraphQL surface (shipped in `w1/m11`): `customDomains(id: String!): [CustomDomain]`,
  `customDomain(id: String!, name: String!): CustomDomain`,
  `addCustomDomain(id: String!, name: String!): CustomDomain`,
  `deleteCustomDomain(id: String!, name: String!): Boolean`.
- `CustomDomain` type fields: `id`, `name`, `domainType`, `verificationStatus`, `serverStatus`.
- Codegen reads `src/**/*.graphql` and writes to `src/graphql/definitions.ts`;
  requires `CODEGEN_SESSION_TOKEN` (see `dashboard/CLAUDE.md`).
- Follow the pattern in `src/features/services/` where existing `.graphql` files live.

## Steps

1. Create `src/features/services/custom-domains.graphql` with:
   - `query CustomDomains($id: String!)` selecting all five fields.
   - `mutation AddCustomDomain($id: String!, $name: String!)` returning all fields.
   - `mutation DeleteCustomDomain($id: String!, $name: String!)` returning `Boolean`.
2. Run `yarn codegen` (needs `CODEGEN_SESSION_TOKEN`) and confirm the generated
   hooks (`useCustomDomainsQuery`, `useAddCustomDomainMutation`,
   `useDeleteCustomDomainMutation`) appear in `src/graphql/definitions.ts`.
3. Commit only the `.graphql` file and the generated `definitions.ts` diff.

## Files

- `dashboard/src/features/services/custom-domains.graphql` (new)
- `dashboard/src/graphql/definitions.ts` (generated, updated by codegen)

## Acceptance criteria

- [ ] `yarn codegen` succeeds with no schema errors for the new operations.
- [ ] Typed hooks for all three operations exist in `definitions.ts`.

## Out of scope

- UI wiring (t002–t004).
