fix(n8n): repair school intake upload flow
This commit is contained in:
@@ -108,36 +108,35 @@ _Last updated: 2026-05-13_
|
||||
|
||||
---
|
||||
|
||||
### 18 — Telegram School Intake → Postgres → Paperless v1.1
|
||||
**What it does:** Accepts multipart school-work upload plus metadata (`class_name`, `assignment_name`, `submission_kind`, optional semester/course_code/paper_kind), records it in shared Postgres, and uploads it into Paperless with a deterministic `intake_id`-based filename.
|
||||
### 18 — Telegram School Intake → Postgres → Paperless v1.2
|
||||
**What it does:** Accepts multipart school-work upload plus metadata (`class_name`, `assignment_name`, `submission_kind`, optional semester/course_code/paper_kind), uploads it into Paperless with a deterministic `intake_id`-based filename/title, and returns webhook success context.
|
||||
|
||||
**Local artifact checks completed:**
|
||||
- [x] Workflow JSON validates with `python3 -m json.tool`
|
||||
- [x] Companion helper script validates with `node --check school/intake/submit_to_n8n.js`
|
||||
- [x] Class profile example JSON validates with `python3 -m json.tool`
|
||||
- [x] v1.1 removes the `require('crypto')` dependency for easier live rollout
|
||||
- [x] v1.2 fixes the Paperless multipart upload node to use `inputDataFieldName` for binary form upload
|
||||
- [x] Live-tested 2026-05-14 with `Why am I here` DOCX; Paperless created document `49`
|
||||
|
||||
**Pre-test checklist:**
|
||||
- [ ] Shared Postgres table `school_paperless_intake` created from `docs/reference/SCHOOL_INTAKE_POSTGRES_SCHEMA.sql`
|
||||
- [ ] `PAPERLESS_API_TOKEN` exposed to n8n through env vars
|
||||
- [ ] Postgres credential `Shared Postgres` created in n8n and wired into workflow 18
|
||||
- [ ] Webhook path `https://n8n.paccoco.com/webhook/school/intake/upload` reachable from Doris/OpenClaw helper
|
||||
- [x] `PAPERLESS_API_TOKEN` exposed to n8n through env vars
|
||||
- [x] Webhook path `https://n8n.paccoco.com/webhook/school/intake/upload` reachable from Doris/OpenClaw helper
|
||||
|
||||
**Test approach:** POST a small DOCX/PDF through the intake webhook, confirm a row appears in `school_paperless_intake`, and verify the document lands in Paperless with filename prefix `school-...`.
|
||||
**Test approach:** POST a small DOCX/PDF through the intake webhook and verify the document lands in Paperless with filename prefix `school-...` and deterministic title.
|
||||
|
||||
---
|
||||
|
||||
### 19 — Paperless School Intake Metadata Enrichment v1.0
|
||||
**What it does:** Receives Paperless post-consumption webhook for intake-managed documents, resolves the deterministic `intake_id` from the stored filename, loads the intake record from Postgres, then reapplies deterministic title/tags and optional document type/correspondent mapping.
|
||||
### 19 — Paperless School Intake Metadata Enrichment v1.1
|
||||
**What it does:** Receives Paperless post-consumption webhook for intake-managed documents, resolves the deterministic `intake_id` from the stored filename, derives metadata from deterministic filename/title, then reapplies deterministic title/tags and optional correspondent mapping.
|
||||
|
||||
**Local artifact checks completed:**
|
||||
- [x] Workflow JSON validates with `python3 -m json.tool`
|
||||
|
||||
**Pre-test checklist:**
|
||||
- [ ] Paperless webhook configured to POST `https://n8n.paccoco.com/webhook/school/intake/paperless-enrich`
|
||||
- [ ] Workflow 18 already working so intake-managed filenames exist in Paperless
|
||||
- [ ] `PAPERLESS_API_TOKEN`, `PAPERLESS_TAG_SCHOOL`, `PAPERLESS_TAG_ASSIGNMENTS`, and `PAPERLESS_TAG_TELEGRAM` exposed to n8n
|
||||
- [ ] Optional mapping env vars supplied when ready: `PAPERLESS_TAG_CLASS_MAP_JSON`, `PAPERLESS_TAG_SUBMISSION_KIND_MAP_JSON`, `PAPERLESS_DOCUMENT_TYPE_PAPER_KIND_MAP_JSON`, `PAPERLESS_CORRESPONDENT_CLASS_MAP_JSON`
|
||||
- [ ] Postgres credential `Shared Postgres` created in n8n and wired into workflow 19
|
||||
- [x] Paperless webhook target configured to POST `https://n8n.paccoco.com/webhook/school/intake/paperless-enrich`
|
||||
- [x] Workflow 18 working so intake-managed filenames exist in Paperless
|
||||
- [x] `PAPERLESS_API_TOKEN` exposed to n8n
|
||||
- [ ] Optional mapping env vars supplied when ready: `PAPERLESS_TAG_SCHOOL`, `PAPERLESS_TAG_ASSIGNMENTS`, `PAPERLESS_TAG_TELEGRAM`, `PAPERLESS_TAG_CLASS_MAP_JSON`, `PAPERLESS_TAG_SUBMISSION_KIND_MAP_JSON`, `PAPERLESS_CORRESPONDENT_CLASS_MAP_JSON`
|
||||
|
||||
**Test approach:** After a workflow-18 upload is consumed by Paperless, POST `{"document_id": <id>}` to `/webhook/school/intake/paperless-enrich` and verify title/tags are updated and the DB row status becomes `enriched`.
|
||||
**Test approach:** After a workflow-18 upload is consumed by Paperless, POST `{"document_id": <id>}` to `/webhook/school/intake/paperless-enrich` and verify title/tags enrichment succeeds. Live-tested on document `49`.
|
||||
|
||||
Reference in New Issue
Block a user