summaryrefslogtreecommitdiff
path: root/requirements/data_models
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-07-15 22:23:18 +0100
committerJoe Carstairs <me@joeac.net>2025-07-15 22:23:18 +0100
commitd8945831d2cebeec98691a39ec19dac13cf0d66f (patch)
treeab0f9179598bbdaac9170848aeddb0ec0934d205 /requirements/data_models
parent4b4621a18ff301708f98c8a6d89cb78e184ac795 (diff)
parent376e5623ef0a202c391908a7a3093df4d804a052 (diff)
Merge branch 'main' of https://git.joeac.net/joeac/schist
Diffstat (limited to 'requirements/data_models')
-rw-r--r--requirements/data_models/dml-bucket.md20
-rw-r--r--requirements/data_models/dml-drip.md15
-rw-r--r--requirements/data_models/dml-pipe.md21
-rw-r--r--requirements/data_models/dml-transaction.md15
4 files changed, 52 insertions, 19 deletions
diff --git a/requirements/data_models/dml-bucket.md b/requirements/data_models/dml-bucket.md
index b0d978f..3e33028 100644
--- a/requirements/data_models/dml-bucket.md
+++ b/requirements/data_models/dml-bucket.md
@@ -2,10 +2,18 @@
A bucket represents a real category of spending, like beer or holidays.
-| Field | Type | Description |
-| ------- | ------ | ----------------------------------------------------- |
-| id | string | |
-| name | string | A short description of the real category of spending. |
-| balance | number | The amount of money currently in the bucket. |
+| Field | Type | Description |
+| ----------------- | ------ | ----------------------------------------------------- |
+| name | string | A short description of the real category of spending. |
+| balance | number | The amount of money currently in the bucket. |
+| balance_cache_key | string | A cache key for the balance. See notes. |
-Source: req-017
+Constraints:
+
+- `name` must be unique.
+
+Notes:
+
+- `balance_cache_key` must be of the format: `<drip_id>:<transaction_id>`.
+
+Sources: req-027, req-028, req-030
diff --git a/requirements/data_models/dml-drip.md b/requirements/data_models/dml-drip.md
new file mode 100644
index 0000000..127c73e
--- /dev/null
+++ b/requirements/data_models/dml-drip.md
@@ -0,0 +1,15 @@
+# dml-drip
+
+A drip represents a single daily transaction from the tank into a bucket as a
+result of a pipe.
+
+| Field | Type | Description |
+| --------- | ------ | ------------------------------------------------------------- |
+| id | string | A unique ID. |
+| bucket_id | string | The ID of the bucket into which this drip drap. |
+| pipe_id | string | The ID of the pipe which from which this drip drap. |
+| date | date | The date on which this drip drap. |
+| amount | number | The amount of money which dripped. |
+| timestamp | number | The time on which this drip was inserted as a Unix timestamp. |
+
+Sources: req-030, req-037
diff --git a/requirements/data_models/dml-pipe.md b/requirements/data_models/dml-pipe.md
index a7d2e8a..d889b0a 100644
--- a/requirements/data_models/dml-pipe.md
+++ b/requirements/data_models/dml-pipe.md
@@ -3,10 +3,19 @@
A pipe represents how much money the user wants to come in or go out of a
bucket. In other words, it represents a flow of money from the tank to a bucket.
-| Field | Type | Description |
-| ------ | ------ | -------------------------------------------------------- |
-| id | string | |
-| amount | number | The amount of money flowing through the pipe. |
-| period | string | How long it takes for `amount` to flow through the pipe. |
+| Field | Type | Description |
+| --------- | ------ | -------------------------------------------------------- |
+| id | string | |
+| amount | number | The amount of money flowing through the pipe. |
+| period | string | How long it takes for `amount` to flow through the pipe. |
+| bucket_id | string | The ID of the bucket to which this pipe corresponds. |
-Source: req-017
+Constraints:
+
+- `period` must be one of these options:
+ - `day`
+ - `week`
+ - `month`
+ - `year`
+
+Sources: req-017, req-037
diff --git a/requirements/data_models/dml-transaction.md b/requirements/data_models/dml-transaction.md
index db7d1ed..b6b76f7 100644
--- a/requirements/data_models/dml-transaction.md
+++ b/requirements/data_models/dml-transaction.md
@@ -3,12 +3,13 @@
A transaction represents a real transaction, such as buying a beer or depositing
a wage slip. It may be associated with at most one bucket.
-| Field | Type | Description |
-| ------------ | ------- | -------------------------------------------------- |
-| id | string | |
-| amount | number | The amount of money involved in the transaction. |
-| date | date | The calendar date when the transaction took place. |
-| counterparty | string | The other party in the transaction. |
-| bucket | string? | The bucket associated with the transaction. |
+| Field | Type | Description |
+| ------------ | ------- | ---------------------------------------------------------- |
+| id | string | |
+| amount | number | The amount of money involved in the transaction. |
+| date | date | The calendar date when the transaction took place. |
+| counterparty | string | The other party in the transaction. |
+| bucket_id | string? | The bucket associated with the transaction. |
+| timestamp | number | The time the transaction was inserted as a Unix timestamp. |
Source: req-010, req-017