From c436422acc2494b0ab11c1d1cf388fc8ae5a41c4 Mon Sep 17 00:00:00 2001 From: DEls Date: Thu, 17 Sep 2026 15:15:27 +0200 Subject: [PATCH] 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. --- scripts/pb-add-dn-batches.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/pb-add-dn-batches.py b/scripts/pb-add-dn-batches.py index 3bc9eea..98cfbf7 100755 --- a/scripts/pb-add-dn-batches.py +++ b/scripts/pb-add-dn-batches.py @@ -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},