Mutation Inputs

CreateInput and UpdateInput types for GraphQL mutations

Audience: Programmer

CreateInput and UpdateInput types define the structure of data accepted by create and update mutations in the pyck GraphQL API. These input types ensure type safety and validation when modifying data.

Naming Patterns

pyck follows consistent naming patterns for mutation inputs:

  • Create: Create[Entity]Input (e.g., CreateInventoryItemInput)

  • Update: Update[Entity]Input (e.g., UpdateInventoryItemInput)

CreateInput Types

CreateInput types define required and optional fields when creating new entities.

Common Structure

input CreateEntityInput {
  # Required fields
  name: String!
  type: EntityType!
  
  # Optional fields
  description: String
  data: Map
  
  # Relationships
  parentId: ID
  categoryIds: [ID!]
}

Example: Creating an Inventory Item

UpdateInput Types

UpdateInput types define which fields can be modified when updating existing entities. All fields are typically optional, allowing partial updates.

Common Structure

Example: Updating an Inventory Item

Available Input Types

Inventory Management

Create Input
Update Input
Used For

CreateInventoryItemInput

UpdateInventoryItemInput

Products and items

CreateRepositoryInput

UpdateRepositoryInput

Storage locations

CreateItemMovementInput

UpdateItemMovementInput

Item movements

CreateRepositoryMovementInput

UpdateRepositoryMovementInput

Bulk movements

CreateCollectionMovementInput

UpdateInventoryCollectionInput

Collection movements

CreateInventoryItemSetInput

UpdateInventoryItemSetInput

Item groupings

Order Management

Create Input
Update Input
Used For

CreatePickingOrderInput

UpdatePickingOrderInput

Picking orders

CreatePickingOrderItemInput

UpdatePickingOrderItemInput

Order line items

CreateReceivingInboundInput

UpdateReceivingInboundInput

Inbound shipments

CreateReceivingInboundItemInput

UpdateReceivingInboundItemInput

Inbound items

Master Data

Create Input
Update Input
Used For

CreateCustomerInput

UpdateCustomerInput

Customer records

CreateSupplierInput

UpdateSupplierInput

Supplier records

CreateDataTypeInput

UpdateDataTypeInput

JSON schema definitions

System Configuration

Create Input
Update Input
Used For

CreateFileInput

UpdateFileInput

File attachments

CreateWorkflowInput

UpdateWorkflowInput

Workflow definitions

CreateWorkflowSignalInput

UpdateWorkflowSignalInput

Workflow triggers

Common Fields

Data Field

Most entities support a flexible data field of type Map for custom attributes:

Timestamps

Create/Update timestamps are automatically managed:

  • createdAt: Set automatically on creation

  • updatedAt: Updated automatically on modification

Relationships

Input types handle relationships through ID references:

Best Practices

1. Partial Updates

Only include fields you want to change in update mutations:

2. Null Handling

Use null to explicitly clear optional fields:

3. Data Field Validation

The data field is validated against DataType schemas:

4. Batch Operations

For bulk updates, consider using specialized batch mutations when available:

JavaScript Example

See Also

Last updated

Was this helpful?