GraphQL Gateway :8080
🏷️

Product & Catalog API

Catalog: /apis/product-api

Governs items taxonomy, categories, variants attributes (price, compare price, options maps), and location-aware distance searches. Integrates PostGIS extensions for spatial queries.

Endpoints Reference

Complete list of GraphQL mutations, queries, gRPC procedures, and HTTP routes for this module.

GraphQL Query

nearbyProducts(latitude: Float!, longitude: Float!, radiusMeters: Float!)

Fetches products listed near coordinates using PostGIS geography index sorting.

🔓 Public Access
Request Syntax / Parameters
query { nearbyProducts(latitude: -17.83, longitude: 31.05, radiusMeters: 5000) { distance product { id title latitude longitude } } }
Expected JSON Response
{
  "data": {
    "nearbyProducts": [
      {
        "distance": 312.4,
        "product": {
          "id": "bc316519-c607-44f2-8405-d110b599c084",
          "title": "Harare Local Product",
          "latitude": -17.8292,
          "longitude": 31.0522
        }
      }
    ]
  }
}
GraphQL Mutation

createProduct(input: CreateProductInput!)

Saves a catalog listing with multiple customizable variants and options. Enforces Category attribute JSON schemas.

🔒 JWT Auth SELLER
Request Syntax / Parameters
mutation { createProduct(input: { categoryId: "564bb", title: "iPhone 15", variants: [{ sku: "IP15-256", price: 1199.99, options: { "color": "Black" } }], attributes: { "os": "iOS" } }) { id status } }
Expected JSON Response
{ "data": { "createProduct": { "id": "bc316519-c607-44f2-8405-d110b599c084", "status": "ACTIVE" } } }
GraphQL Query

categories

Returns recursive hierarchical category menus with nested child links.

🔓 Public Access
Request Syntax / Parameters
query { categories { id name slug children { id name slug } } }
Expected JSON Response
{ "data": { "categories": [ { "id": "5d7d3", "name": "Electronics", "children": [ { "id": "564bb", "name": "Smartphones" } ] } ] } }

Database Tables & Data Models

Relational database schemas and custom payload models governing this service domain.

📂 products (PostgreSQL)

Stores core listing detail records and attributes JSON schemas.

Field Name Data Type Description / Constraint
id UUID (Primary Key) Unique listing identifier.
seller_id UUID Associated storefront identifier.
category_id UUID Leaf category mapping reference.
title / description TEXT Catalog texts.
attributes JSONB Category-specific specification maps (e.g. {'os':'iOS'}).
geom GEOGRAPHY(POINT, 4326) PostGIS coordinate location marker (synced from seller coordinates).

📂 product_variants (PostgreSQL)

Specific purchase models under a parent product (e.g. storage sizes/colors).

Field Name Data Type Description / Constraint
id UUID (Primary Key) Unique variant identifier.
product_id UUID Parent product reference key.
sku VARCHAR(100) Unique Stock Keeping Unit barcode.
price / compare_price NUMERIC(12,2) Active currency listing value and old cross-out value.
options JSONB Combination identifier map (e.g. {'storage':'256GB','color':'Titanium'}).