docs + locations

This commit is contained in:
JMARyA 2024-09-02 18:40:02 +02:00
parent e1618b40ef
commit 48f00d8f6f
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
17 changed files with 390 additions and 33 deletions

View file

@ -1,3 +1,67 @@
# Item
An item is the base concept for CDB. Everything is an Item. An Item describes a general product or object. An item can have multiple variants, beeing the concrete instances of the Item like brand products or different flavors, etc.
An item is the base concept for CDB. Everything is an Item. An Item describes a general product or object.
## Defining an Item
An Item is defined within a markdown file with frontmatter. Items are the root dataset of CDB. One can use [this](https://git.hydrar.de/red/itemdb) as a starting point or create their own items.
For example, we define a "Water" Item:
```markdown
---
name: "Water"
variants:
common:
name: "Common Water"
---
# Water
This is a Water Item
```
The file consist of the frontmatter, containing values for the item, and the rest of the markdown file containing a description.
## Variants
Variants are different version of the same item. Each variant can have their own values. Each item needs at least one variant.
For our water example:
```yml
name: "Water"
variant:
regular:
name: "Regular Water"
sparkling:
name: "Sparkling Water"
destilled:
name: "Destilled Water"
```
Here we have defined three "Water" item variants.
## Inventory
With the items defined, you can start tracking their inventory. See [Transaction](Transaction.md).
### Min
You can set a minimum required inventory for an item variant. This will trigger events when an item reaches a low inventory threshold.
```yml
name: "Water"
variants:
regular:
name: "Regular Water"
min: 2
```
This will ensure that at least two units of the "Regular Water" item variant are in inventory.
### Expiry
You can set a default expiry time for an Item Variant. This value is defined as days until expiry.
```yml
name: "Water"
variants:
regular:
name: "Regular Water"
expiry: 30
```
This will mark any item variant as expired if it's older than 30 days.