fix(dn-batches): include created/updated system fields in collection schema

The dn_batches and dn_batch_notes collections were created without
PB's standard 'created' / 'updated' date fields, which broke any
query that sorted on them (the tick route, the inbox page).

Live PB was patched inline by the Task 16 verification; this commit
makes the script that creates these collections include the fields
from the start so a fresh deployment doesn't trip on the same bug.
This commit is contained in:
DEls 2026-09-17 15:15:27 +02:00
parent 826050c48a
commit c436422acc

View file

@ -69,6 +69,12 @@ def main():
"name": "DN_BATCHES",
"type": "base",
"fields": [
# PB system fields — required so `sort=created` / `sort=-created`
# queries work (the tick route and the inbox page both sort on
# these). PB manages their values internally once the field
# names match.
{"name": "created", "type": "date", "required": False, "onCreate": True},
{"name": "updated", "type": "date", "required": False, "onCreate": True, "onUpdate": True},
{"name": "file", "type": "file", "required": False, "maxSelect": 1, "maxSize": 20971520},
{"name": "file_hash", "type": "text", "required": False},
{"name": "site", "type": "relation", "required": True,
@ -93,6 +99,8 @@ def main():
"name": "DN_BATCH_NOTES",
"type": "base",
"fields": [
{"name": "created", "type": "date", "required": False, "onCreate": True},
{"name": "updated", "type": "date", "required": False, "onCreate": True, "onUpdate": True},
{"name": "batch", "type": "relation", "required": True,
"collectionId": batches_id, "maxSelect": 1, "cascadeDelete": True},
{"name": "note_index", "type": "number", "required": False},