askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
messages.json · 4.8 KB · 100 lines
| 1 | { |
| 2 | "name": "messages", |
| 3 | "title": "Messages", |
| 4 | "version": 1, |
| 5 | "storage": "append", |
| 6 | "description": "One message within a thread: direction, the address it came from, its body, and the deferred-transport linkage fields (in_reply_to, external_message_id) a future IMAP sync would populate. A faithful port of a private predecessor-system audit's Message model, not part of this repo -- that source stored \"content + external email fields/headers/direction\" on one row; this schema keeps that same grain (no separate body_html field -- the audit gave no evidence the source split html from text at this level of detail, so this package carries one body_text field rather than inventing a split it can't confirm). \"storage\": \"append\" because a message, once sent or received, is (mostly) a write-once log entry -- the only field that ever flips after creation is is_read -- the same profile that put app-thread's thread_comments and app-catalog's stock_moves on append storage (docs/append-only-storage-design.md): write-hot, rarely-if-ever content-edited, an inspectable history in the raw file. Per-recipient To/Cc/Bcc addressing is normalized out to message_recipients, not flattened onto this row -- the source system normalized recipients into their own MessageRecipient table too (see schemas/message_recipients.json), and this package follows that same split rather than the alternative of flattening address lists onto Message. forms.default is not rendered by any page in this package in v1 -- composing/sending a real message is deferred (see dbbasic-package.json) -- it is kept for schema-generator consistency and a future compose page, same as forum_topics carries ai_summary unwritten.", |
| 7 | "fields": [ |
| 8 | { |
| 9 | "name": "id" |
| 10 | }, |
| 11 | { |
| 12 | "name": "thread_id", |
| 13 | "type": "relation", |
| 14 | "required": true, |
| 15 | "relation": {"collection": "message_threads", "display_field": "subject"}, |
| 16 | "label": "Thread" |
| 17 | }, |
| 18 | { |
| 19 | "name": "direction", |
| 20 | "type": "enum", |
| 21 | "required": true, |
| 22 | "enum": ["inbound", "outbound"], |
| 23 | "label": "Direction", |
| 24 | "help": "inbound = received mail (the deferred IMAP sync's future insertion path); outbound = sent by this mailbox's owner (the deferred SMTP send's future insertion path). v1 has no page that creates a message directly through either path -- see dbbasic-package.json's deferred list." |
| 25 | }, |
| 26 | { |
| 27 | "name": "from_address", |
| 28 | "type": "text", |
| 29 | "required": true, |
| 30 | "label": "From", |
| 31 | "validation": {"max_length": 254} |
| 32 | }, |
| 33 | { |
| 34 | "name": "subject", |
| 35 | "type": "text", |
| 36 | "label": "Subject", |
| 37 | "validation": {"max_length": 300}, |
| 38 | "help": "A message can carry its own subject distinct from the thread's (e.g. a \"Re:\" prefix on a reply), same as real email." |
| 39 | }, |
| 40 | { |
| 41 | "name": "body_text", |
| 42 | "type": "textarea", |
| 43 | "label": "Body" |
| 44 | }, |
| 45 | { |
| 46 | "name": "is_read", |
| 47 | "type": "boolean", |
| 48 | "default": "true", |
| 49 | "label": "Read", |
| 50 | "help": "Same default reasoning as message_threads.is_read: v1 ships no inbound-transport insertion path, so a message created here by hand, seed, or draft save defaults to already-read. A future sync job is what should set this false on newly-synced inbound mail." |
| 51 | }, |
| 52 | { |
| 53 | "name": "sent_at", |
| 54 | "type": "datetime", |
| 55 | "label": "Sent At", |
| 56 | "help": "Set for an outbound message once the deferred SMTP send exists. Carried as a field now (same posture as app-invoices' paid_at) even though nothing in this package writes it yet." |
| 57 | }, |
| 58 | { |
| 59 | "name": "received_at", |
| 60 | "type": "datetime", |
| 61 | "label": "Received At", |
| 62 | "help": "Set for an inbound message once the deferred IMAP sync exists. Carried as a field now, not written by anything in this package yet." |
| 63 | }, |
| 64 | { |
| 65 | "name": "in_reply_to", |
| 66 | "type": "text", |
| 67 | "label": "In Reply To", |
| 68 | "validation": {"max_length": 998}, |
| 69 | "help": "The external mail system's Message-ID this message replies to (RFC 5322 shape), for the deferred IMAP threading linkage. Carried, not validated or resolved by anything here." |
| 70 | }, |
| 71 | { |
| 72 | "name": "external_message_id", |
| 73 | "type": "text", |
| 74 | "label": "External Message ID", |
| 75 | "validation": {"max_length": 998}, |
| 76 | "help": "This message's identity in the external mail system (IMAP/mailcow) once the deferred sync exists. Carried, not populated by anything in this package." |
| 77 | }, |
| 78 | { |
| 79 | "name": "owner_id", |
| 80 | "type": "text", |
| 81 | "label": "Owner" |
| 82 | }, |
| 83 | { |
| 84 | "name": "created_at", |
| 85 | "type": "datetime", |
| 86 | "label": "Created", |
| 87 | "read_only": true |
| 88 | } |
| 89 | ], |
| 90 | "forms": { |
| 91 | "default": {"fields": ["subject", "body_text"]} |
| 92 | }, |
| 93 | "views": { |
| 94 | "list_mode": "cards", |
| 95 | "list_fields": ["subject", "from_address", "direction", "received_at"] |
| 96 | }, |
| 97 | "search": { |
| 98 | "fields": ["subject", "body_text", "from_address"] |
| 99 | } |
| 100 | } |