Data Models

Complete reference for all data structures and DTOs used in the Inventory Service.

Overview

This section provides detailed information about all data structures, DTOs (Data Transfer Objects), and models used throughout the Inventory Service API.

Core DTOs

WarehouseDTO

Represents warehouse information for creation and retrieval operations.

{ "id": 123, "name": "Main Distribution Center", "type": "INTERNAL", "description": "Primary warehouse facility", "partner_id": 456 }
Field Type Description
id mixed Unique identifier (null for new warehouses)
name string Warehouse name
type string Warehouse type from WarehouseTypeEnum
description string Warehouse description
partner_id integer Associated partner ID

LocationDTO

Represents precise location coordinates within a warehouse.

{ "floor": 1, "row": 5, "section": 12, "level": 2, "sort_number": 12051202 }
Field Type Description
floor integer Floor number
row integer Row number
section integer Section number
level integer Level/shelf number
sort_number integer Auto-generated sorting number (floor + level + padded row + padded section)

LotDTO

Represents lot/batch information for products with expiration tracking.

{ "id": 123, "product_id": 456, "lot_number": "LOT-2024-001", "expiration_date": "2024-12-31T23:59:59Z", "manufacturing_year": 2024 }

MoveStorageUnitDTO

Complete structure for storage unit movement operations.

{ "id": null, "warehouse_id": 123, "product_id": 456, "quantity": 100, "location_id_to_put": 20, "location_id_to_remove": 10, "serial_number": "SN123456", "lot": { /* LotDTO */ }, "process_details": { /* ProcessDetailsDTO */ } }

ProcessDetailsDTO

Contains all information needed to execute a storage movement process.

{ "type": "PARCEL_PROCESS", "origin": "ACTIVE_STORAGE", "destination": "RESERVED", "parcel_method": "EXACT_LOT_NUMBERS_METHOD", "parcel_id": 12345, "workflow_id": 67890, "picker_id": 111, "packing_point_id": 222, "process_reason": "Inventory adjustment", "allowed_to_ship_not_filled_parcels": true, "is_partial_reservation_allowed": false, "lot_numbers": [ { "lot_number": "LOT-2024-001", "quantity": 50, "product_id": 456 } ] }
Field Type Description
type ProcessTypeEnum Type of process being executed
origin StoragePlaceEnum Source storage location
destination StoragePlaceEnum Destination storage location
parcel_method ParcelMethodEnum Method for parcel processing (nullable)
parcel_id integer Associated parcel ID (nullable)
workflow_id integer Workflow ID for tracking (nullable)
picker_id integer ID of the picker (for picking processes)
packing_point_id integer Packing point ID (for packing processes)
process_reason string Reason for the process (required for corrections/scrap)

Filter Structures

FilterDto

Generic filtering structure used across multiple endpoints.

{ "columns": ["id", "name", "quantity"], "filters": [ { "field": "quantity", "operator": ">", "value": 0 } ], "with": ["location", "lot", "warehouse"] }

GetStockDto

Specific DTO for stock retrieval operations.

{ "warehouse_id": 123, "partner_id": 456, "get_mode": "by_filter", "page": 1, "per_page": 50, "filter": { /* FilterDto */ } }

Database Models

Warehouse Model

Main warehouse entity with relationships to other models.

Fillable Fields

  • name - Warehouse name
  • type - Warehouse type
  • partner_id - Associated partner

Relationships

  • warehouseData() - HasOne: Additional warehouse metadata
  • locations() - BelongsToMany: Associated warehouse locations
  • pickings() - HasMany: Picking units
  • packings() - HasMany: Packing units
  • waitingReservations() - HasMany: Pending reservations

Location Model

Represents specific locations within warehouses.

Storage Unit Models

Different storage unit types for various stages of inventory:

  • ActiveStorageUnit - Main inventory storage
  • ReservedStorageUnit - Reserved for specific orders
  • PufferStorageUnit - Buffer storage
  • ScrapStorageUnit - Damaged or unusable items
  • PickingUnit - Items in picking process
  • PackingUnit - Items in packing process

Exception Handling

ExceptionDTO

Standard structure for error responses.

Standard structure for error responses. Exact format not verified from controller code.

Custom Exceptions

  • BaseException - Base class for all custom exceptions
  • ExceptionWithLogLevel - Exceptions with specific log levels

Traits and Utilities

FilterTrait

Provides dynamic filtering capabilities to models.

BelongsToWarehouse

Trait for models that belong to a specific warehouse.

EnumTrait

Utility functions for working with enums.