Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/microservices-patterns/ftgo-application/llms.txt

Use this file to discover all available pages before exploring further.

This page documents the complete GraphQL schema exposed by the FTGO GraphQL API Gateway. The schema is defined in ftgo-api-gateway-graphql/src/schema.js using graphql-tools. Every query and mutation listed here is available at the /graphql endpoint.

Full schema

type Query {
  orders(consumerId: Int!): [Order]
  order(orderId: Int!): Order
  consumer(consumerId: Int!): Consumer
}

type Mutation {
  createConsumer(c: ConsumerInfo): Consumer
}

type Order {
  orderId: ID
  consumerId: Int
  consumer: Consumer
  restaurant: Restaurant
  deliveryInfo: DeliveryInfo
}

type Restaurant {
  id: ID
  name: String
}

type Consumer {
  id: ID
  firstName: String
  lastName: String
  orders: [Order]
}

input ConsumerInfo {
  firstName: String
  lastName: String
}

type DeliveryInfo {
  status: DeliveryStatus
  estimatedDeliveryTime: Int
  assignedCourier: String
}

enum DeliveryStatus {
  PREPARING
  READY_FOR_PICKUP
  PICKED_UP
  DELIVERED
}

Queries

orders

Returns all orders placed by a given consumer. Each order’s consumer, restaurant, and deliveryInfo fields are resolved lazily — they are only fetched from their respective backend services when the client includes them in the query.

Arguments

consumerId
Int
required
The numeric ID of the consumer whose orders to retrieve.

Return type

Returns [Order] — a list of Order objects.

Example

query {
  orders(consumerId: 1) {
    orderId
    consumer {
      id
      firstName
      lastName
    }
    restaurant {
      id
      name
    }
    deliveryInfo {
      status
      estimatedDeliveryTime
      assignedCourier
    }
  }
}
curl http://localhost:8088/graphql \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"query":"{ orders(consumerId:1) { orderId, restaurant { name } } }"}'

order

Returns a single order by its ID.

Arguments

orderId
Int
required
The numeric ID of the order to retrieve.

Return type

Returns a single Order object, or null if not found.

Example

query {
  order(orderId: 42) {
    orderId
    consumerId
    restaurant {
      id
      name
    }
    deliveryInfo {
      status
    }
  }
}

consumer

Returns a single consumer by ID. The orders field on the returned Consumer is resolved by calling the Order History Service when requested.

Arguments

consumerId
Int
required
The numeric ID of the consumer to retrieve.

Return type

Returns a single Consumer object, or null if not found.

Example

query {
  consumer(consumerId: 1) {
    id
    firstName
    lastName
    orders {
      orderId
    }
  }
}
curl http://localhost:8088/graphql \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"query":"query { consumer(consumerId:1) { id, firstName, lastName } }"}'

Mutations

createConsumer

Creates a new consumer in the Consumer Service and returns the created record.

Arguments

c
ConsumerInfo
Consumer name details. See ConsumerInfo for fields.

Return type

Returns the newly created Consumer object. The orders field on the returned object is an empty list.

Example

mutation ($fn: String, $ln: String) {
  createConsumer(c: { firstName: $fn, lastName: $ln }) {
    id
    orders {
      orderId
    }
  }
}
With variables:
curl http://localhost:8088/graphql \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{
    "query": "mutation ($fn: String, $ln: String) { createConsumer(c: {firstName: $fn, lastName: $ln}) { id, orders { orderId } } }",
    "variables": { "fn": "Chris", "ln": "Richardson" }
  }'

Types

Order

Represents a single order placed through the FTGO application. The consumer, restaurant, and deliveryInfo fields are resolved via API composition: each triggers a call to the relevant downstream service.
orderId
ID
Unique identifier for the order.
consumerId
Int
The numeric ID of the consumer who placed the order.
consumer
Consumer
The consumer who placed this order. Resolved by calling the Consumer Service using the order’s consumerId.
restaurant
Restaurant
The restaurant that received this order. Resolved by calling the Restaurant Service using the order’s restaurantId.
deliveryInfo
DeliveryInfo
Current delivery status and courier assignment. Resolved by calling the Delivery Service using the order’s orderId.

Consumer

Represents a customer registered in the FTGO Consumer Service.
id
ID
Unique identifier for the consumer.
firstName
String
Consumer’s first name.
lastName
String
Consumer’s last name.
orders
[Order]
All orders placed by this consumer. If the Consumer was returned as part of an orders query the list may already be populated; otherwise it is fetched from the Order History Service.

Restaurant

Represents a restaurant registered in the FTGO Restaurant Service.
id
ID
Unique identifier for the restaurant.
name
String
Display name of the restaurant.

DeliveryInfo

Represents the current delivery state of an order, returned by the Delivery Service.
status
DeliveryStatus
Current delivery status. One of the DeliveryStatus enum values.
estimatedDeliveryTime
Int
Estimated delivery time, in minutes from order placement.
assignedCourier
String
Name or identifier of the courier assigned to this order. null if no courier has been assigned yet.

ConsumerInfo (input)

Input type used when creating a new consumer via the createConsumer mutation.
firstName
String
Consumer’s first name.
lastName
String
Consumer’s last name.

Enums

DeliveryStatus

Represents the lifecycle of an order’s delivery.
ValueDescription
PREPARINGThe restaurant is preparing the order.
READY_FOR_PICKUPThe order is ready and waiting for a courier.
PICKED_UPA courier has picked up the order.
DELIVEREDThe order has been delivered to the consumer.

The deliveryInfo field on Order is resolved via a separate Delivery Service. If that service is unavailable, the deliveryInfo field resolves to null rather than causing the entire query to fail.

Build docs developers (and LLMs) love