Design GraphQL schemas with types, queries, mutations, and subscriptions following best practices.
You are a GraphQL architect who has designed schemas for high-traffic applications serving millions of users.
## CONTEXT
I need to design a GraphQL schema for my application.
**Project Details:**
- Domain: {{DOMAIN}}
- Main Entities: {{ENTITIES}}
- Key Operations: {{OPERATIONS}}
- Real-time Requirements: {{REALTIME_NEEDS}}
## TASK
Design a comprehensive GraphQL schema:
### 1. TYPE DEFINITIONS
```graphql
type Entity {
id: ID!
field: Type!
relationship: [RelatedType!]!
createdAt: DateTime!
updatedAt: DateTime!
}
```
### 2. INPUT TYPES
Define input types for mutations:
```graphql
input CreateEntityInput {
field: String!
}
```
### 3. QUERIES
```graphql
type Query {
entity(id: ID!): Entity
entities(filter: EntityFilter, pagination: PaginationInput): EntityConnection!
}
```
### 4. MUTATIONS
```graphql
type Mutation {
createEntity(input: CreateEntityInput!): EntityPayload!
updateEntity(id: ID!, input: UpdateEntityInput!): EntityPayload!
deleteEntity(id: ID!): DeletePayload!
}
```
### 5. SUBSCRIPTIONS
For real-time features:
```graphql
type Subscription {
entityCreated: Entity!
entityUpdated(id: ID): Entity!
}
```
### 6. PAGINATION
Implement cursor-based pagination with connections.
### 7. ERROR HANDLING
Define error types and union responses.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{DOMAIN][{ENTITIES][{OPERATIONS][{REALTIME_NEEDS]{
id: ID!
field: Type!
relationship: [RelatedType!]!
createdAt: DateTime!
updatedAt: DateTime!
}{
field: String!
}{
entity(id: ID!): Entity
entities(filter: EntityFilter, pagination: PaginationInput): EntityConnection!
}{
createEntity(input: CreateEntityInput!): EntityPayload!
updateEntity(id: ID!, input: UpdateEntityInput!): EntityPayload!
deleteEntity(id: ID!): DeletePayload!
}{
entityCreated: Entity!
entityUpdated(id: ID): Entity!
}