Skip to main content

Production Queries

Queries for retrieving production run information.

productionRun

Get a single production run by ID or filter criteria.

Arguments

type ProductionRunArgs {
"""
Optional. Production run ID.
"""
id: ID

"""
Optional. Filter criteria for the production run.
"""
filter: ProductionRunFilter
}

input ProductionRunFilter {
"""
Filter by multiple production run IDs.
"""
id_in: [ID!]

"""
Filter by multiple brand IDs.
"""
brandId_in: [ID!]

"""
Filter by start date greater than or equal to.
"""
startDate_gte: DateTime

"""
Filter by start date less than or equal to.
"""
startDate_lte: DateTime

"""
Filter by end date greater than or equal to.
"""
endDate_gte: DateTime

"""
Filter by end date less than or equal to.
"""
endDate_lte: DateTime
}

Example Query

query GetProductionRun {
productionRun(id: "123") {
id
startDate
endDate
description
brand {
id
name
}
trackers {
id
currentStatus
}
deliveryLocations {
id
name
}
storageLocations {
id
name
}
}
}

productionRuns

Get a filtered list of production runs.

Arguments

type ProductionRunsArgs {
"""
Optional filter criteria.
"""
filter: ProductionRunFilter
}

Example Query

query GetProductionRuns {
productionRuns(
filter: {
brandId_in: ["123", "456"]
startDate_gte: "2023-01-01T00:00:00Z"
}
) {
id
description
startDate
endDate
brand {
id
name
}
trackers {
id
currentStatus
}
}
}

productionRunsByBrand

Get all production runs for a specific brand.

Arguments

type ProductionRunsByBrandArgs {
"""
ID of the brand.
"""
brandId: ID!
}

Example Query

query GetProductionRunsByBrand {
productionRunsByBrand(brandId: "123") {
id
description
startDate
endDate
trackers {
id
currentStatus
}
}
}

productionRunsByDateRange

Get production runs within a specific date range.

Arguments

type ProductionRunsByDateRangeArgs {
"""
Start date for the range.
"""
startDate: DateTime!

"""
End date for the range.
"""
endDate: DateTime!
}

Example Query

query GetProductionRunsByDateRange {
productionRunsByDateRange(
startDate: "2023-01-01T00:00:00Z"
endDate: "2023-12-31T23:59:59Z"
) {
id
description
startDate
endDate
brand {
id
name
}
}
}

activeProductionRuns

Get all currently active production runs (those without an end date).

Example Query

query GetActiveProductionRuns {
activeProductionRuns {
id
description
startDate
brand {
id
name
}
trackers {
id
currentStatus
latestLocation {
location {
latitude
longitude
}
}
}
}
}

Error Handling

Common Errors

Error CodeDescription
PRODUCTION_RUN_NOT_FOUNDProduction run ID not found
INVALID_DATE_RANGEInvalid date range specified
PERMISSION_DENIEDNot authorized to view production run

Example Error Response

{
"errors": [
{
"message": "Production run not found",
"extensions": {
"code": "PRODUCTION_RUN_NOT_FOUND",
"id": "123"
}
}
]
}

Best Practices

  1. Authentication

    • Always include valid JWT with client_list claim
    • Handle token expiration gracefully
  2. Date Ranges

    • Use ISO 8601 format for dates
    • Keep date ranges reasonable
    • Consider timezone handling
  3. Performance

    • Request only needed fields
    • Use appropriate filters
    • Consider caching strategies
  4. Error Handling

    • Handle all error cases gracefully
    • Provide meaningful error messages
    • Implement retry logic where appropriate