cdb/docs/Location.md
2024-09-02 18:40:02 +02:00

1.6 KiB

Location

A Location represents a physical location where items can be stored.

Defining locations

A Location is defined within a JSON file. What a Location represents is up to you. One location can be as specific as individual storage boxes or as general as a whole room. You can even define a hierarchy and additional properties.

Basic Example: Storage Box

{
    "name": "Storage Box"
}

Hierarchy

You can add a hierarchy to your locations. Let's say for example we have one building we use for storage.

So we create storage_building1.json:

{
    "name": "Storage Building"
}

Then define a room for storage in storage_room1.json:

{
    "name": "First storage room",
    "parent": "storage_building1"
}

The parent field here defines that this location is inside another location, therefor setting up a hierarchy from larger scope locations to smaller scope. The parent field expects a location ID, which is typically the filename of the JSON without the extension.

With this we can go even more detailed:

{
    "name": "Black Storage Box",
    "parent": "storage_room1"
}

Properties

You can define various properties for a location. This allows for checking the best location for an item based on it's requirements. If locations are in a hierarchy they will inherit the properties of their parents by default.

Conditions

Some items might be better stored under certain conditions. You can set the conditions of a location like temperature.

Example: Freezer

{
    "name": "Freezer",
    "conditions": {
        "temperature": -10
    }
}