Production Mutations
Mutations for managing production runs.
createProductionRun
Creates a new production run.
Arguments
"""
Input for creating a production run.
"""
input CreateProductionRunInput {
"""
When the production run starts.
"""
startDate: DateTime!
"""
Optional end date.
"""
endDate: DateTime
"""
Brand ID associated with the production.
"""
brandId: ID!
"""
Optional description.
"""
description: String
"""
Optional image URL for the production run.
"""
imageUrl: String
"""
Optional delivery location IDs.
"""
deliveryLocationIds: [ID!]
"""
Optional storage location IDs.
"""
storageLocationIds: [ID!]
}
Example Mutation
mutation CreateProductionRun {
createProductionRun(
input: {
startDate: "2023-01-01T00:00:00Z"
brandId: "123"
description: "Q1 Production Run"
imageUrl: "https://example.com/images/q1-production.jpg"
deliveryLocationIds: ["loc_456"]
storageLocationIds: ["store_789"]
}
) {
id
startDate
description
brand {
id
name
}
deliveryLocations {
id
name
}
storageLocations {
id
name
}
}
}
updateProductionRun
Updates an existing production run.
Arguments
"""
Input for updating a production run.
"""
input UpdateProductionRunInput {
"""
Optional new start date.
"""
startDate: DateTime
"""
Optional new end date.
"""
endDate: DateTime
"""
Optional new brand ID.
"""
brandId: ID
"""
Optional new description.
"""
description: String
"""
Optional new image URL.
"""
imageUrl: String
"""
Optional new delivery location IDs.
"""
deliveryLocationIds: [ID!]
"""
Optional new storage location IDs.
"""
storageLocationIds: [ID!]
}
Example Mutation
mutation UpdateProductionRun {
updateProductionRun(
id: "123"
input: {
endDate: "2023-12-31T23:59:59Z"
description: "Updated Q1 Production Run"
deliveryLocationIds: ["loc_789"]
}
) {
id
startDate
endDate
description
deliveryLocations {
id
name
}
}
}
deleteProductionRun
Deletes a production run.
Arguments
"""
ID of the production run to delete.
"""
id: ID!
Example Mutation
mutation DeleteProductionRun {
deleteProductionRun(id: "123")
}
Location Management Mutations
addDeliveryLocationToProductionRun
Adds a delivery location to a production run.
mutation AddDeliveryLocation {
addDeliveryLocationToProductionRun(
productionRunId: "123"
deliveryLocationId: "loc_456"
) {
id
deliveryLocations {
id
name
}
}
}
removeDeliveryLocationFromProductionRun
Removes a delivery location from a production run.
mutation RemoveDeliveryLocation {
removeDeliveryLocationFromProductionRun(
productionRunId: "123"
deliveryLocationId: "loc_456"
) {
id
deliveryLocations {
id
name
}
}
}
addStorageLocationToProductionRun
Adds a storage location to a production run.
mutation AddStorageLocation {
addStorageLocationToProductionRun(
productionRunId: "123"
storageLocationId: "store_456"
) {
id
storageLocations {
id
name
}
}
}
removeStorageLocationFromProductionRun
Removes a storage location from a production run.
mutation RemoveStorageLocation {
removeStorageLocationFromProductionRun(
productionRunId: "123"
storageLocationId: "store_456"
) {
id
storageLocations {
id
name
}
}
}
Error Handling
Common Errors
| Error Code | Description |
|---|---|
PRODUCTION_RUN_NOT_FOUND | Production run ID not found |
BRAND_NOT_FOUND | Brand ID not found |
LOCATION_NOT_FOUND | Location ID not found |
INVALID_DATE_RANGE | End date before start date |
INVALID_IMAGE_URL | Invalid image URL format |
Example Error Response
{
"errors": [
{
"message": "Production run not found",
"extensions": {
"code": "PRODUCTION_RUN_NOT_FOUND",
"id": "123"
}
}
]
}
Best Practices
-
Date Management
- Use ISO 8601 format
- Validate date ranges
- Handle timezones properly
-
Location Management
- Validate location existence
- Handle location changes
- Update related records
-
Brand Association
- Validate brand exists
- Check brand permissions
- Handle brand changes
-
Security
- Validate permissions
- Audit changes
- Log sensitive operations