Cane Agency · Specification · Platform infrastructureสถาบันอ้อย · เอกสารข้อกำหนด · โครงสร้างพื้นฐาน
This document reads the platform data model from the identity substrate — the eighteen federation entities that carry who a person is, which tenant they act for, and what that membership may do, plus the department profile records that attach to a tenant. Every definition mirrors SPEC-ERD and graph/spec-graph.json — a perspective document adds actor-relevant reading, never divergent attributes. Federation is the sole identity writer: every other perspective reads the person/tenant/membership graph through the token claim contract (SPEC-DDD-FED Section 3), never by querying this store.
เอกสารนี้อ่าน model ข้อมูลของ platform จากชั้นอัตลักษณ์ — สิบแปด entity ของ federation ที่บรรทุกว่าบุคคลเป็นใคร ทำหน้าที่แทนtenant รายใด และสมาชิกภาพนั้นทำอะไรได้ พร้อมเรกคอร์ดโปรไฟล์หน่วยงานที่ผูกกับ tenant ทุกนิยามสะท้อน SPEC-ERD และ graph/spec-graph.json — เอกสารรายมุมมองเพิ่มการตีความที่เกี่ยวกับผู้ใช้ ไม่สร้างแอตทริบิวต์ที่แตกต่าง federation เป็นผู้เขียนอัตลักษณ์เพียงผู้เดียว: มุมมองอื่นทุกมุมมองอ่าน graph (กราฟ) person/tenant/membership ผ่านสัญญา claim (SPEC-DDD-FED ข้อ 3) ไม่ใช่โดยสอบถามคลังนี้
| Relationความเกี่ยวข้อง | EntitiesEntity |
|---|---|
| Owns — identity coreเป็นเจ้าของ — แกนอัตลักษณ์ | Person · Tenant · TenantCapacity · Membership · MemberInvitation · SurfaceRoleGrant · PermissionCatalog · RolePermission · ViewAsSession |
| Owns — domain profilesเป็นเจ้าของ — โปรไฟล์ capacity | Farmer · Mill · FinancialInstitution · Contractor (each attaches to its tenant via tenant_id; deep definitions in the capacity ERDs)(แต่ละตัวผูกกับ tenant ผ่าน tenant_id; นิยามเชิงลึกอยู่ใน ERD ราย capacity) |
| Referencesอ้างอิง | Every organizational record (via tenant_id) · ConsentGrant (X1, owned by credit_risk)ทุกเรกคอร์ดองค์กร (ผ่าน tenant_id) · ConsentGrant (X1 เป็นของ credit_risk) |
| Contextบริบท | federation (absorbs the former network_identity)(รวม network_identity เดิม) |
| WorkflowsWorkflow | WF-24 · WF-25 · WF-26 · WF-27 · WF-01 |
Scoped view of the platform model from this perspective, rendered from the graph (entities · relationships · dataModeling, v0.4.0). Solid boxes are entities documented at full depth in this family — bold = primary key, gold = foreign key. Dashed boxes are shared entities; the label names their home document. Cardinalities read at each line end.
มุมมองเฉพาะด้านของ model ทั้ง platform render จาก graph (entities · relationships · dataModeling, v0.4.0) กล่องเส้นทึบคือ entity ที่บันทึกเชิงลึกในเอกสารตระกูลนี้ — ตัวหนา = primary key, สีทอง = foreign key กล่องเส้นประคือ entity ที่ใช้ร่วม โดยป้ายระบุเอกสาร home; อ่าน cardinality ที่ปลายเส้นแต่ละด้าน
v0.25.0 (PROP-026 D-3/D-4), re-specified at v0.46.0, PROP-075 approved & applied 3 Aug 2026: the identity core carries the tenant’s two internal axes plus the directory. Department (DEP-########: department_id · tenant_id · parent_department_id? · department_path · status) is the BUSINESS UNIT — the merge of the retired Department and LegalEntity, self-parenting, of unbounded model depth (guardrail 8), and the only thing a grant is scoped to. Its legal identity is a dated profile it owns and no longer five columns on the row (Section 15, A-111 R-ONENODE, spec v0.75.0). Site (SIT-########: site_id · tenant_id · name · site_kind · address · province_code · geo? · mill_id? · status) is the PHYSICAL LOCATION — flat, never a legal body, never a scope — and DepartmentSite (DPS-########) joins them many-to-many with one is_primary. Then the directory: DirectoryGroup (group_dir_id · tenant_id · name · owner_department_id · nested_in? · status) · DirectoryGroup (group_dir_id · tenant_id · name · owner_department_id · nested_in? · status) · DirectoryGroupMember (dir_member_id · group_dir_id · membership_id · effective_from · effective_to? · added_by) · DirectoryGrant (grant_id · group_dir_id · surface · role_id · department_id? · department_path_pattern? · allowed · granted_by · granted_at · four_eyes_ref? · status) — and three added columns: SurfaceRoleGrant.department_id (uniqueness becomes membership_id, surface, department_id), RolePermission.scope_type +department_path, PermissionCatalog.department_delegable. Attribute detail: SPEC-ERD-GRP Section 2.3; the entities are authored in the factory_group context but are federation machinery — federation stays the sole identity writer.
v0.25.0 (PROP-026 D-3/D-4) ระบุใหม่ที่ v0.46.0, PROP-075 approved & applied 3 Aug 2026: แกนอัตลักษณ์ถือสองแกนภายในของ tenant พร้อมไดเรกทอรี Department (DEP-########) คือหน่วยธุรกิจ — การรวมของ Department กับ LegalEntity ที่เลิกใช้แล้ว มีแม่ของตัวเองได้ ลึกเท่าใดก็ได้ (เพดานเชิงปฏิบัติการ 8 ชั้น) และจะถูกจัดเป็นนิติบุคคลตามแถว legalForms ก็ได้ Site (SIT-########) คือสถานที่ทางกายภาพ เรียงชั้นเดียว ไม่เคยเป็นนิติบุคคลและไม่เคยเป็นขอบเขตสิทธิ์ ส่วน DepartmentSite (DPS-########) เชื่อมทั้งสองแบบหลายต่อหลาย แล้วจึงเป็นไดเรกทอรี: DirectoryGroup · DirectoryGroupMember · DirectoryGrant
| Entity · codeEntity · รหัส | Attributesแอตทริบิวต์ | Rules that biteกฎที่มีผล |
|---|---|---|
| Person PSN-######## | person_id, name_prefix?, first_name, last_name, nickname?, birth_date, province, amphor?, tumboon?, email?, email_verified?, national_id_hash?, id_verified_level, status | The human, and it owns nothing (PROP-074 R-ACCOUNT). v0.54.0 (PROP-078 approved & applied 7 Aug 2026): the name is stored in PARTS — name_prefix? (a namePrefixes row, Section 4.1) · first_name · last_name — beside nickname? (ชื่อเล่น, the name he is called; never on a document that carries legal or financial weight). full_name is RETIRED: any display string is composed at render time (FR-437). birth_date is declared once, entered in the Buddhist era and stored as a calendar date; it is never a way in (FR-439, A-75). province · amphor? · tumboon? is the DECLARED CONTACT LOCATION — the PROP-047 registry codes, picked and never typed (FR-438) — a fact about the human that grants nothing, exactly like status. The four completion-written columns are all absent while the profile step is skipped (FR-422). Uniqueness lives on PhoneNumber.e164 among ACTIVE rows (NFR-14 as amended at v0.42.0); national_id_hash is unique among VERIFIED persons. id_verified_level: none | phone | national_id | ekyc. Never deleted while memberships exist; PDPA erasure by anonymization. Maps onto AspNetUsers.มนุษย์ และไม่เป็นเจ้าของสิ่งใด (PROP-074 R-ACCOUNT) v0.54.0 (PROP-078 อนุมัติและ apply 7 ส.ค. 2569): ชื่อเก็บเป็นส่วนย่อย — name_prefix? (แถวของ namePrefixes ข้อ 4.1) · first_name · last_name — พร้อม nickname? (ชื่อเล่น ชื่อที่คนเรียก ไม่ใช้บนเอกสารที่มีผลทางกฎหมายหรือการเงิน) full_name ยกเลิก: สตริงแสดงผลประกอบขึ้นตอนเรนเดอร์ (FR-437) birth_date แจ้งครั้งเดียว กรอกเป็น พ.ศ. เก็บเป็นวันที่ปฏิทิน และไม่ใช่ทางเข้า (FR-439, A-75) province · amphor? · tumboon? คือที่อยู่ติดต่อที่แจ้งไว้ — รหัสทะเบียน PROP-047 เลือกจากรายการ ไม่พิมพ์เอง (FR-438) — เป็นข้อเท็จจริงเกี่ยวกับคนที่ไม่ให้สิทธิ์ใด เช่นเดียวกับ status ทั้งสี่คอลัมน์ที่เขียนตอนทำเสร็จจะว่างทั้งหมดขณะข้ามขั้นตอนโปรไฟล์ (FR-422) ความไม่ซ้ำอยู่ที่ PhoneNumber.e164 เฉพาะแถวที่ใช้งานอยู่ (NFR-14 แก้ที่ v0.42.0); national_id_hash ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว id_verified_level: none | phone | national_id | ekyc ไม่ลบขณะยังมีสมาชิกภาพ; การลบตาม PDPA ทำโดยลบการระบุตัวตน แมปกับ AspNetUsers |
| PhoneNumber PHN-######## | phone_number_id, person_id, e164, label?, is_primary, verified, verified_at?, added_at, added_via, last_used_at?, status, removed_at?, removed_reason?, reusable_after? | v0.42.0 (PROP-067) — one row per number a person can be reached at and can sign in with. UNIQUE (e164) among ACTIVE rows is where NFR-14’s constraint now lives: a number reaches exactly one person at a time. Exactly one active row is is_primary — the number FR-63 invites, every notification targets and the payment advice names. Removal never deletes; reusable_after is the cooling period that stops a recycled SIM walking into the account.v0.42.0 (PROP-067) — หนึ่งแถวต่อหนึ่งเบอร์ที่ติดต่อได้และใช้เข้าระบบได้ UNIQUE (e164) เฉพาะแถวที่ใช้งานอยู่ คือที่ลงใหม่ของข้อบังคับ NFR-14: หนึ่งเบอร์ไปถึงคนเดียวในเวลาหนึ่ง มีแถวที่เป็น is_primary ได้แถวเดียว — เบอร์ที่ FR-63 ใช้เชิญ ที่การแจ้งเตือนไปถึง และที่ใบแจ้งการจ่ายเงินอ้างถึง การถอนไม่ลบ; reusable_after คือระยะพักที่กัน SIM ที่ถูกนำกลับมาขายใหม่เดินเข้าบัญชี |
| ExternalIdentity EXI-######## append-only | external_identity_id, person_id, provider, provider_subject, provider_email?, provider_email_verified, display_hint, bound_at, bound_via, bound_from_session?, last_used_at?, status, unbound_at?, unbound_reason? | v0.42.0 (PROP-067) — an external provider account used as a way in. UNIQUE (provider, provider_subject) is the whole security model of linking: one provider account reaches exactly one person, forever. provider is authored google · apple · line · facebook; only line · google · apple are offered in V1 (D-1). provider_email and display_hint are display only — never an index, never a search key (NFR-135, NFR-136).v0.42.0 (PROP-067) — บัญชีผู้ให้บริการภายนอกที่ใช้เป็นทางเข้า UNIQUE (provider, provider_subject) คือแบบจำลองความปลอดภัยของการผูกทั้งหมด: หนึ่งบัญชีไปถึงคนเดียว ตลอดไป provider เขียนไว้ google · apple · line · facebook; V1 เสนอเฉพาะ line · google · apple (D-1) provider_email และ display_hint ใช้แสดงผลเท่านั้น ไม่เป็นดัชนี ไม่เป็นคีย์ค้นหา (NFR-135, NFR-136) |
| Passkey PKY-######## | passkey_id, person_id, credential_id, public_key, sign_count, aaguid?, transports, backup_eligible, backup_state, label, created_at, created_from_session, last_used_at?, status, revoked_at?, revoked_reason? | v0.42.0 (PROP-067) — a WebAuthn credential bound to the person; credential_id UNIQUE. label is farmer-authored (“โทรศัพท์ของฉัน”) because a list of AAGUIDs is not a list a grower can prune. backup_eligible / backup_state are recorded and never used to refuse (FR-370).v0.42.0 (PROP-067) — credential ตามมาตรฐาน WebAuthn ที่ผูกกับบุคคล; credential_id ไม่ซ้ำ label ชาวไร่ตั้งเอง (“โทรศัพท์ของฉัน”) เพราะรายการ AAGUID ไม่ใช่รายการที่ชาวไร่จัดการได้ backup_eligible / backup_state บันทึกไว้และห้ามใช้ปฏิเสธ (FR-370) |
| DeviceCredential DVC-######## | credential_id, person_id, device_key_hash, public_key, key_alg, hardware_backed, user_verification, device_label, device_hint, enrolled_at, enrolled_via, enrolment_reversible_until?, last_used_at?, status, revoked_at?, revoke_reason? | v0.43.0 (PROP-068) — the THIRD entry factor: a key pair in the device keystore, opened by the device biometric, the device screen lock or a six-digit app PIN. One row per device, several per person. hardware_backed is recorded and never used to refuse — it only raises the AAL. Deliberately not a variant of Passkey (A-75 honesty). UNIQUE (person_id, device_key_hash). FR-379 · FR-380.v0.43.0 (PROP-068) — ปัจจัยที่ให้เข้าตัวที่สาม: คู่กุญแจใน keystore ของเครื่อง เปิดด้วยชีวมาตรของเครื่อง ล็อกหน้าจอ หรือ PIN หกหลักของแอป หนึ่งแถวต่อเครื่อง หลายแถวต่อคน hardware_backed บันทึกไว้และห้ามใช้ปฏิเสธ — ใช้ยก AAL เท่านั้น จงใจไม่เป็นชนิดย่อยของ Passkey (ความซื่อตรงตาม A-75) UNIQUE (person_id, device_key_hash) FR-379 · FR-380 |
| IdentityCheck IDC-######## append-only | identity_check_id, person_id, purpose, method, document_kind, document_ref, liveness_result, match_score?, card_birth_date?, birth_date_match?, national_id_hash, result, checked_at, checked_by?, vendor_ref?, consent_ref, evidence_retained_until, status | v0.42.0 (PROP-067, D-5/D-13) — the e-KYC record: the national ID card read plus a live check that the holder is the person on the card. Writes Person.national_id_hash (unique among verified persons) and may raise id_verified_level — identity proofing, the one thing no credential may do (A-75). Never a way in. Keeps the result, not the face: the image and any template are deleted at evidence_retained_until. v0.54.0 (PROP-078): the card read already extracted the birth date and nothing held it — card_birth_date? now persists it and birth_date_match? records the comparison against Person.birth_date (match | mismatch | not_read). The check RECORDS the comparison and does not resolve it: it never overwrites the declaration, and a mismatch is a flag for review, never a refusal and never a lockout (FR-439, PROP-068 R-NOLOCKOUT).v0.42.0 (PROP-067, D-5/D-13) — ระเบียน e-KYC: อ่านบัตรประชาชนพร้อมการตรวจสดว่าผู้ถือคือคนในบัตร เขียน Person.national_id_hash (ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว) และยก id_verified_level ได้ — เป็นการพิสูจน์ตัวตน สิ่งที่ credential ทำไม่ได้ (A-75) ไม่ใช่ทางเข้า เก็บผล ไม่เก็บใบหน้า: ภาพและ template ถูกลบที่ evidence_retained_until v0.54.0 (PROP-078): การอ่านบัตรดึงวันเกิดออกมาอยู่แล้วและไม่มีที่เก็บ — card_birth_date? เก็บค่านั้น และ birth_date_match? บันทึกผลเทียบกับ Person.birth_date (match | mismatch | not_read) การตรวจบันทึกผลเทียบ ไม่ตัดสินแทน: ไม่เขียนทับค่าที่แจ้งไว้ และความไม่ตรงกันคือธงให้ทบทวน ไม่ใช่การปฏิเสธและไม่ใช่การล็อกบัญชี (FR-439, PROP-068 R-NOLOCKOUT) |
| AuthSession ASN-######## | session_id, person_id, active_tenant_id, active_department_id?, device_label, auth_method, aal, created_at, last_seen_at, expires_at, revoked_at?, revoked_by?, revoke_reason? | v0.42.0 (PROP-067) — the record the model did not have: without it “sign me out of the other phone” is unimplementable. auth_method names the factor that minted the session and aal its assurance (the amr/aal claims); active_tenant_id is why removing a Membership revokes exactly that tenant’s sessions and nothing else (FR-366, FR-373).v0.42.0 (PROP-067) — ระเบียนที่แบบจำลองยังไม่มี ถ้าไม่มี “ออกจากระบบเครื่องอีกเครื่อง” ทำไม่ได้ auth_method บอกปัจจัยที่ออกเซสชัน และ aal บอกระดับความเชื่อมั่น (claim amr/aal); active_tenant_id คือเหตุที่การถอน Membership ยกเลิกเฉพาะเซสชันของ tenant นั้น ไม่แตะอย่างอื่น (FR-366, FR-373) |
| AuthEvent AEV-######## append-only | auth_event_id, person_id, kind, method, result, session_id?, actor_person_id?, device_hint, ip_country, at | v0.42.0 (PROP-067) — the sibling of the applied au-01 register: that screen answers who touched the records, this answers who got into the account. actor_person_id names the officer on a staff-assisted act (A-71). Read by the holder as a section of sec-01 (FR-374); retention follows NFR-109’s confidential-wall class.v0.42.0 (PROP-067) — พี่น้องของทะเบียน au-01 ที่ apply แล้ว: หน้านั้นตอบว่าใครแตะระเบียน อันนี้ตอบว่าใครเข้าบัญชี actor_person_id ระบุชื่อเจ้าหน้าที่เมื่อเป็นการกระทำโดยเจ้าหน้าที่ (A-71) เจ้าของอ่านได้เป็นส่วนหนึ่งของ sec-01 (FR-374); การเก็บรักษาใช้ชั้นกำแพงความลับของ NFR-109 |
| Tenant TNT-######## | tenant_id, display_name, representation, stewarded_by?, status, created_at | The economic actor and the CONTAINER — of memberships, departments, sites, books, capacities and records. It asserts nothing about what it IS (v0.46.0, PROP-075 approved & applied 3 Aug 2026, A-81 R-CONTAINER): kind, legal_name?, registration_no? and base_province are deleted — a tenant is never itself a natural person, a company, a cooperative or a government agency, legal identity lives on Department and location on Site. Every tenant is a container of PEOPLE (Membership 1 — 1..*) and holds exactly ONE root department (R-ROOT). Profile records attach via tenant_id and keep their own ids.ผู้กระทำการทางเศรษฐกิจและเป็นภาชนะ — ของ membership หน่วยงาน สถานที่ บัญชี capacity และระเบียน ไม่ประกาศว่าตัวเองเป็นอะไร (v0.46.0, PROP-075 approved & applied 3 Aug 2026) โดยลบ kind legal_name? registration_no? และ base_province — สภาพนิติบุคคลอยู่ที่ Department ส่วนที่ตั้งอยู่ที่ Site ทุก tenant มีหน่วยงานรากหนึ่งโหนด |
| Department DEP-######## | department_id, tenant_id, parent_department_id?, department_path, status | The BUSINESS UNIT and the only node type of the tenant’s organizational tree (v0.46.0, PROP-075 approved & applied 3 Aug 2026) — the merge of the retired Department and LegalEntity. Single-parent, acyclic, unbounded in the model and bounded operationally at 8 levels. The five legal attributes are RETIRED to DepartmentLegalProfile (spec v0.75.0, PROP-084 approved & applied 18 Aug 2026, A-111 R-ONENODE · R-LEGALDATED): a department with no profile is an internal ฝ่าย or กอง, which is the common case, and the present legal picture is DERIVED rather than mirrored here (Section 15, FR-483). Never the cap table — shareholding stays in OwnershipEdge.หน่วยธุรกิจ และเป็นโหนดชนิดเดียวของต้นไม้เชิงองค์กรของ tenant — รวม Department กับ LegalEntity ที่เลิกใช้แล้ว attribute ทางกฎหมายห้าตัวถูกยกเลิก ย้ายไป DepartmentLegalProfile (spec v0.75.0, PROP-084, A-111) ดูข้อ 15 |
| Site SIT-######## | site_id, tenant_id, name, site_kind, address, province_code, geo?, mill_id?, status | The PHYSICAL LOCATION a tenant operates from (v0.46.0, PROP-075 approved & applied 3 Aug 2026) — mill compound, transfer station, office, warehouse, yard (siteKinds). FLAT: no parent, no children. Never a legal body, never a permission scope, exactly ONE owning tenant (NFR-141); another tenant references a site and never shares it. Receives the location base_province held on entities that have none. Not a cultivation plot.สถานที่ทางกายภาพที่ tenant ดำเนินงาน เรียงชั้นเดียว ไม่เคยเป็นนิติบุคคล และไม่เคยเป็นขอบเขตสิทธิ์ |
| DepartmentSite DPS-######## | department_id, site_id, is_primary, status | PRESENCE — which business unit stands where (v0.46.0, PROP-075 approved & applied 3 Aug 2026). Many-to-many and unique on the pair among live rows: a department may span sites or stand at one, a site may host departments from different branches, and zero is valid on both sides. Neither side may collapse into a column on the other. One row per department may be is_primary — the operating address a document prints. An operational convenience, NOT a security surface: it scopes nothing.การตั้งอยู่ — หน่วยงานใดอยู่ที่ไหน แบบหลายต่อหลาย ห้ามยุบด้านใดเป็นคอลัมน์ของอีกด้าน |
| TenantCapacity TCA-######## append-only | capacity_id, tenant_id, capacity, status, required_level, verified_by?, evidence_ref?, granted_at, suspended_at?, revoked_at? | capacity: grower | quota | mill | contractor | bank | government; status: pending | active | suspended | revoked. UNIQUE (tenant_id, capacity). Exclusivity (NFR-16): an active bank or government capacity forbids any other active capacity — enforced at grant and re-checked at every compile. Append-only; revoking a capacity suspends its surfaces' grants.capacity: grower | quota | mill | contractor | bank | government; status: pending | active | suspended | revoked UNIQUE (tenant_id, capacity) เอกสิทธิ์ (NFR-16): bank หรือ government ที่ active ห้ามมี capacity อื่นที่ active — บังคับตอนให้และตรวจซ้ำทุกครั้งที่คอมไพล์ ต่อท้ายเท่านั้น; การเพิกถอน capacity ระงับ grant ของช่องทางนั้น v0.45.0 (PROP-074) — the tenant-held cell of the two-axis model (A-78) and the only standing that confers ENTITLEMENT: it owns, signs, is paid and carries the isolation wall. Each definition declares its origin and holder, and may declare requires — the qualifications evaluated at grant and every re-check (FR-393). Composition is governed by CompositionRule. |
| Membership MBR-######## | membership_id, person_id, tenant_id, is_self, title?, status, invited_by?, joined_at | The person↔tenant join. is_self marks the individual tenant's automatic membership (its owner). One person may hold many memberships, each with its own grants; status: invited | active | suspended | left. Leaving a tenant never touches the person's others. Invitation is by phone (FR-63).การเชื่อม person↔tenant is_self ทำเครื่องหมายสมาชิกภาพอัตโนมัติของ tenant individual (เป็น owner) หนึ่งบุคคลถือได้หลายสมาชิกภาพ แต่ละอันมี grant ของตน; status: invited | active | suspended | left ออกจาก tenant หนึ่งไม่กระทบอันอื่น เชิญด้วยเบอร์โทร (FR-63) v0.50.0 (PROP-072 approved & applied 4 Aug 2026) — status = invited finally has a PRODUCER and an expiry: a MemberInvitation (FR-397). Acceptance writes the membership, its grants and its permission-group membership in ONE transaction (FR-398); ending it runs the eight-consequence removal contract and records who ended it, when and the reason (FR-403); a membership that has ended is never reactivated — coming back is a new membership and a re-chosen position (FR-406). v0.45.0 (PROP-074) — is_self is written at tenant FOUNDING — the person's first tenant-held capacity request — not at sign-up, because sign-up no longer mints a tenant at all (FR-391, FR-392). |
| MemberInvitation MIN-######## append-only | invitation_id, tenant_id, department_path, permission_group_id, surface_roles, target_kind, target_hash, issued_by, token_hash, expires_at, status, accepted_by_person_id?, accepted_at? | v0.50.0 (PROP-072 approved & applied 4 Aug 2026) — a tenant invites a PERSON into a POSITION. Issued by a membership (issued_by), never by a person, so the authority is the position and the invitation survives the issuer leaving. target_kind: phone | provider_email — a phone target is proved by verifying the invited number, a provider-email target only by signing in with the external identity provider that owns that address; the email is an ADDRESS and never an identity, so uniqueness (NFR-14), every recovery path and the Person key stay on the verified number. target_hash stores either kind hashed and is never rendered back to the issuer after issue (NFR-144). One single-use token as a link or QR; expires_at is 7 days out and published, re-issuable without limit; status: issued | accepted | declined | expired | revoked. The issuer learns WHO accepted, only after acceptance, and about a decline the bare fact and nothing more — there is deliberately no declined_at the issuer reads. Not a mode of Invitation and not a mode of NetworkInvitation: the four admissions are told apart by what is admitted (A-91).v0.50.0 (PROP-072 approved & applied 4 ส.ค. 2569) — tenant เชิญคนเข้าสู่ตำแหน่ง ออกโดยสมาชิกภาพ (issued_by) ไม่ใช่โดยตัวคน อำนาจจึงอยู่ที่ตำแหน่งและคำเชิญอยู่รอดเมื่อผู้ออกลาออก target_kind: phone | provider_email — ปลายทางแบบเบอร์พิสูจน์ด้วยการยืนยันเบอร์ที่ถูกเชิญ ปลายทางแบบอีเมลพิสูจน์ด้วยการเข้าสู่ระบบผ่านผู้ให้บริการตัวตนภายนอกที่เป็นเจ้าของที่อยู่นั้นเท่านั้น อีเมลเป็นที่อยู่ ไม่ใช่ตัวตน ความไม่ซ้ำ (NFR-14) ทุกเส้นทางการกู้คืน และกุญแจของ Person จึงยังอยู่บนเบอร์ที่ยืนยันแล้ว target_hash เก็บแบบแฮชทั้งสองชนิดและไม่แสดงกลับให้ผู้ออกหลังออกแล้ว (NFR-144) โทเคนใช้ครั้งเดียวเป็นลิงก์หรือ QR expires_at 7 วันและประกาศไว้ ออกใหม่ได้ไม่จำกัด status: issued | accepted | declined | expired | revoked ผู้ออกรู้ว่าใครตอบรับเมื่อตอบรับแล้วเท่านั้น และรู้เพียงข้อเท็จจริงว่าถูกปฏิเสธ ไม่ใช่โหมดของ Invitation และไม่ใช่โหมดของ NetworkInvitation — ตระกูลนี้แยกกันด้วยสิ่งที่รับเข้า (A-91) |
| Referral RFR-######## status-only | referral_id, referrer_person_id, code, status, opens_count, campaign_id?, created_at, paused_at?, revoked_at? | v0.52.0 (PROP-071 approved & applied 4 Aug 2026) — the fourth admission of A-91, and the one that admits nothing. ONE durable code per person in his farming capacity — no mill, co-op or contractor holds one in V1 — carried as a link, a QR or spoken aloud. code: eight characters from a reduced alphabet with no confusable glyphs, the last a check character, read in two groups of four, never derived from a phone number, a national ID or a name. MULTI-USE, UNTARGETED, no expiry — the opposite of Invitation, NetworkInvitation and MemberInvitation on every axis, and never a mode of any of them. status: active | paused | revoked — the holder pauses, the platform revokes for abuse, and a revoked code never says why to whoever still holds it in a group chat. opens_count is a count and deliberately not a list (FR-411, NFR-137); campaign_id is null for an ordinary grower and set only for a seeded communicator. Writes no membership, no capacity, no stewardship and no registration_status (FR-409).v0.52.0 (PROP-071 อนุมัติและ apply 4 ส.ค. 2569) — สิ่งรับเข้าอันที่สี่ของ A-91 และเป็นอันที่ไม่รับใครเข้าอะไรเลย หนึ่งรหัสถาวรต่อหนึ่งคนในฐานะผู้ปลูก — V1 โรงงาน สหกรณ์ หรือผู้รับเหมาถือไม่ได้ code มีแปดตัวอักษร ตัวสุดท้ายเป็นหลักตรวจสอบ อ่านเป็นสองกลุ่มละสี่ ห้ามสร้างจากเบอร์โทร เลขบัตร หรือชื่อ ใช้ได้หลายครั้ง ไม่มีปลายทาง ไม่หมดอายุ status: active | paused | revoked opens_count เป็นจำนวน ไม่ใช่รายชื่อ (FR-411, NFR-137) และไม่เขียนสมาชิกภาพ capacity การดูแล หรือ registration_status ใด ๆ (FR-409) |
| ReferralCredit RFC-######## append-only | credit_id, referral_id?, referred_person_id, basis, confirmed_at | v0.52.0 (PROP-071 approved & applied 4 Aug 2026) — one row per referred person, written only when the arriving grower himself confirms who told him about us (FR-410). A separate entity because the subject is a different person: the Referral belongs to the referrer and may be shown to him, the credit names somebody else and may never be (FR-411). basis: plot_registered | delivery_recorded — the one real act that makes a referral count (FR-412) — or declined, a row with a NULL referral_id recording that the question was asked and answered with nobody. UNIQUE (referred_person_id) puts the “asked once in a lifetime” rule in the schema rather than on a screen. Survives the referrer own erasure as an anonymised count, because it is a fact about somebody else arrival.v0.52.0 (PROP-071 อนุมัติและ apply 4 ส.ค. 2569) — หนึ่งแถวต่อหนึ่งผู้ถูกแนะนำ เขียนเมื่อผู้มาถึงยืนยันเองเท่านั้น (FR-410) เป็นคนละเอนทิตีเพราะประธานเป็นคนละคน: Referral แสดงให้ผู้แนะนำดูได้ ส่วนเครดิตนี้แสดงไม่ได้เลย basis: plot_registered | delivery_recorded (FR-412) หรือ declined ซึ่งมี referral_id ว่าง ส่วนผู้ถือรหัสไม่เคยเห็นแถวนี้ (FR-411) UNIQUE (referred_person_id) ทำให้ถามครั้งเดียวในชีวิตเป็นข้อเท็จจริงของโครงสร้าง |
| PersonCapacity PCP-######## append-only | capacity_id, person_id, capacity, admission, invitation_id?, status, required_level, verified_by?, evidence_ref?, granted_at, expires_at?, suspended_at?, revoked_at? | v0.45.0 (PROP-074) — the person-held capacity cell. The applied TenantCapacity list with tenant_id → person_id plus expires_at?. Ships with zero members (R-EMPTY); the first real one enters by its own proposal against the A-78 test. Confers evidence only — grants no access.v0.45.0 (PROP-074) — ช่อง capacity ที่บุคคลถือ เปิดตัวโดยไม่มีสมาชิก ให้เพียงหลักฐาน ไม่ให้สิทธิ์เข้าถึง |
| TenantQualification TQL-######## append-only | qualification_id, tenant_id, qualification, issuer, issuer_ref?, status, verified_by?, evidence_ref?, issued_at, registered_at, expires_at?, revoked_at? | v0.45.0 (PROP-074) — an externally-issued credential a tenant holds: mill_licence · bot_licence · quota_registration · ocsb/board/ocsf_appointment · group_ownership_attestation. We register, verify, record the evidence and watch the expiry; we never grant, extend or renew (A-79). status: registered | verified | expired | revoked | refused.v0.45.0 (PROP-074) — ตราสารภายนอกที่ tenant ถือ เราลงทะเบียน ตรวจสอบ เก็บหลักฐาน เฝ้าวันหมดอายุ ไม่เคยให้ ไม่ต่ออายุ (A-79) |
| PersonQualification PQP-######## append-only | qualification_id, person_id, qualification, issuer, issuer_ref?, status, verified_by?, evidence_ref?, issued_at, registered_at, expires_at?, revoked_at? | v0.45.0 (PROP-074) — one applied member: national_id (กรมการปกครอง), the structured form of the dimension required_level has always hard-coded. A credential never raises id_verified_level by itself (A-75).v0.45.0 (PROP-074) — สมาชิกที่ apply แล้วหนึ่งตัวคือ national_id ตราสารไม่เคยยกระดับ id_verified_level ด้วยตัวเอง (A-75) |
| SurfaceRoleGrant SRG-######## | grant_id, membership_id, surface, role_id, granted_by, granted_at, status | UNIQUE (membership_id, surface) — exactly one role per surface per membership; no role-union mechanic exists anywhere. Grants live only on surfaces the tenant is entitled to; revoking a capacity suspends its surfaces' grants. Every tenant has one fixed-full owner role — undeletable. Maps onto AspNetRoles + AspNetUserRoles with a surface key on the join.UNIQUE (membership_id, surface) — หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ; ไม่มีกลไกรวมบทบาทที่ใดเลย grant อยู่เฉพาะช่องทางที่ tenant มีสิทธิ์; การเพิกถอน capacity ระงับ grant ของช่องทางนั้น ทุก tenant มีบทบาท owner เต็มถาวรหนึ่งเดียว — ลบไม่ได้ แมปกับ AspNetRoles + AspNetUserRoles โดยมีคีย์ช่องทางบนการเชื่อม |
| PermissionCatalog PMC-#### | permission_id, surface, group, key, name_th, name_en, description? | Per-surface permission catalog, grouped by department — platform-defined, versioned with the spec. Tenants never invent permissions; they compose roles from the catalog. Account-surface groups: tenants & capacities · members & roles · consents & audit.catalog (แคตตาล็อก) permission รายช่องทาง จัดกลุ่มตามหน่วยงาน — platform กำหนด version ตาม spec (สเปก) tenant ไม่คิด permission เอง แต่ประกอบบทบาทจาก catalog กลุ่มของช่องทาง account: tenants & capacities · members & roles · consents & audit |
| RolePermission RPM-######## | role_permission_id, tenant_id, role_id, permission_id, allowed, scope_type?, scope_ref? | The authored role × permission cell. scope_type: province | district | mill_zone | quota_network | field_set with scope_ref; a scoped row must be equal-or-narrower than the tenant-wide default (FR-65) — scope narrows, never widens. Compiled into perm at sign-in; scope rides inside perm, no standalone claim.เซลล์ role × permission ที่เขียนไว้ scope_type: province | district | mill_zone | quota_network | field_set พร้อม scope_ref; แถวที่จำกัดต้องเท่าหรือแคบกว่าค่าเริ่มต้นทั้ง tenant (FR-65) — ขอบเขตแคบลง ไม่ขยาย คอมไพล์ลง perm ตอนลงชื่อ; ขอบเขตขี่ใน perm ไม่มี claim แยก |
| ViewAsSession VAS-######## append-only | session_id, target_tenant_id, actor_person_id, reason, read_only, started_at, ended_at? | Platform support acts inside a tenant ONLY through this record (X4): permission-gated start, a persistent banner naming the impersonated tenant, every action dual-logged (target's audit + platform audit) and attributed to acting tenant + acting person (FR-67). read_only defaults true. Token carries act (RFC 8693 actor) + vas.ทีมสนับสนุน platform ทำงานใน tenant ได้เฉพาะผ่านเรกคอร์ดนี้ (X4): เริ่มต้องมี permission แบนเนอร์ค้างระบุ tenant ที่สวมสิทธิ์ ทุกการกระทำบันทึกสองชั้น (audit ของเป้าหมาย + audit ของ platform) และระบุที่มาถึง tenant + บุคคลที่กระทำ (FR-67) read_only ปริยายจริง token (โทเคน) บรรทุก act (RFC 8693 actor) + vas |
v0.25.0 (PROP-026), re-specified at v0.46.0, PROP-075 approved & applied 3 Aug 2026: Tenant → Department is 1 — 1..* (every tenant is founded with exactly ONE root department and any number below it — R-ROOT; the tree is never empty and no code path handles “a tenant with no place”), Department → Department is the administrative parent tree with NO TIER CAP (R-DEPTH — PROP-026 OQ-14’s three-tier maximum is withdrawn, depth is bounded operationally at 8 levels, and it is never the cap table), SurfaceRoleGrant → Department (a grant names the unit it applies to — ONE scope axis, never a Site, R-ONESCOPE), Tenant → Site (1 — 0..*, exactly one owning tenant per place), Department ↔ Site through DepartmentSite (0..* — 0..*, R-PRESENCE), Site → Mill (1 — 0..1) and Membership → DirectoryGroupMember → DirectoryGroup → DirectoryGrant (a set carrying grants over named department paths, nesting one level).
v0.25.0 (PROP-026) ระบุใหม่ที่ v0.46.0, PROP-075 approved & applied 3 Aug 2026: Tenant → Department เป็น 1 — 1..* (ทุก tenant มีหน่วยงานรากหนึ่งโหนดพอดี — R-ROOT ต้นไม้จึงไม่เคยว่าง), Department → Department คือต้นไม้การสังกัดเชิงบริหาร ไม่มีเพดานชั้น (R-DEPTH เพดานสามชั้นของ OQ-14 ถูกถอน เหลือเพดานเชิงปฏิบัติการ 8 ชั้น), SurfaceRoleGrant → Department (สิทธิ์ระบุหน่วยงาน — แกนเดียว ไม่เคยระบุสถานที่ R-ONESCOPE), Tenant → Site (1 — 0..*), Department ↔ Site ผ่าน DepartmentSite (0..* — 0..*), Site → Mill (1 — 0..1) และ Membership → DirectoryGroupMember → DirectoryGroup → DirectoryGrant (ชุดที่ถือ grant เหนือ department path)
| From → Toจาก → ไป | Card.คาร์ด. | Ruleกฎ |
|---|---|---|
| Person → Membership | 1 — 1..* | A person holds memberships in any number of tenants; an individual tenant auto-creates a self-membership at birth. Leaving one never touches the others.บุคคลถือสมาชิกภาพใน tenant กี่รายก็ได้; tenant individual สร้าง self-membership อัตโนมัติตอนเกิด ออกจากอันหนึ่งไม่กระทบอันอื่น |
| Tenant → Membership | 1 — 1..* | Every tenant has at least its owner membership, and no act may leave it with zero active memberships holding the owner role (FR-407). A tenant invites further members with a MemberInvitation naming the position; the contact target is the DELIVERY of that invitation, not its model (FR-397, FR-63 as amended v0.50.0).ทุก tenant มีสมาชิกภาพ owner อย่างน้อยหนึ่งราย และไม่มีการกระทำใดทำให้เหลือสมาชิกภาพที่ถือบทบาท owner เป็นศูนย์ได้ (FR-407) tenant เชิญสมาชิกเพิ่มด้วย MemberInvitation ที่ระบุตำแหน่ง ปลายทางติดต่อเป็นการส่งคำเชิญ ไม่ใช่ตัวแบบจำลอง (FR-397, FR-63 แก้ที่ v0.50.0) |
| Tenant → MemberInvitation | 1 — 0..* | v0.50.0 (PROP-072) — a tenant issues member invitations into its own departments only, never across one (A-82, R-ONESCOPE). At most ONE is open per (tenant, target) and issuing a second revokes the first — a partial unique index on (tenant_id, target_hash) WHERE status = issued, so the rule is a schema fact rather than a screen rule.v0.50.0 (PROP-072) — tenant ออกคำเชิญสมาชิกเข้าหน่วยงานของตัวเองเท่านั้น ไม่ข้ามหน่วยงาน (A-82) มีคำเชิญค้างได้หนึ่งใบต่อ (tenant, ปลายทาง) และการออกใบที่สองเพิกถอนใบแรก — เป็น partial unique index บน (tenant_id, target_hash) WHERE status = issued กฎนี้จึงเป็นข้อเท็จจริงของโครงสร้าง ไม่ใช่กฎของหน้าจอ |
| Membership → MemberInvitation | 1 — 0..* | v0.50.0 (PROP-072) — issued_by is the issuing MEMBERSHIP, never the person: the authority is the position, so the invitation stands when the issuer leaves the tenant and the audit names the seat that admitted the member.v0.50.0 (PROP-072) — issued_by คือสมาชิกภาพผู้ออก ไม่ใช่ตัวคน อำนาจอยู่ที่ตำแหน่ง คำเชิญจึงยังมีผลเมื่อผู้ออกออกจาก tenant และบันทึกตรวจสอบระบุตำแหน่งที่รับสมาชิกคนนั้นเข้ามา |
| Person → Referral | 1 — 0..1 | v0.52.0 (PROP-071 approved & applied 4 Aug 2026) — one durable code per person, held in his FARMING capacity only; no institution holds one in V1 (FR-408). The code belongs to the person and survives every capacity change he ever makes.v0.52.0 (PROP-071) — หนึ่งรหัสถาวรต่อหนึ่งคน ถือในฐานะผู้ปลูกเท่านั้น V1 สถาบันถือไม่ได้ และรหัสอยู่รอดทุกการเปลี่ยน capacity |
| Referral → ReferralCredit | 1 — 0..* | v0.52.0 (PROP-071 approved & applied 4 Aug 2026) — a code accumulates attributions as COUNTS; the rows behind the count are never itemised to its holder (FR-411, NFR-137).v0.52.0 (PROP-071) — รหัสสะสมการระบุที่มาเป็นจำนวน แถวข้างหลังจำนวนไม่เคยถูกแจกแจงให้ผู้ถือรหัสเห็น |
| Person → ReferralCredit | 1 — 0..1 | v0.52.0 (PROP-071 approved & applied 4 Aug 2026) — as the REFERRED person: UNIQUE (referred_person_id). Asked once at first open, answered once, never re-asked, whether he named a code or nobody (FR-410).v0.52.0 (PROP-071) — ในฐานะผู้ถูกแนะนำ UNIQUE (referred_person_id) ถามครั้งเดียวเมื่อเปิดครั้งแรก ตอบครั้งเดียว ไม่ถามซ้ำ ไม่ว่าจะระบุรหัสหรือไม่มีใคร |
| Tenant → TenantCapacity | 1 — 1..* | UNIQUE (tenant_id, capacity). An active bank or government capacity forbids any other active capacity (NFR-16). Append-only — revocation never deletes. v0.45.0 (PROP-074) — the tenant exists BECAUSE of this row: the first tenant-held capacity request founds it (FR-392, WF-01 step 2), so a tenant with no capacity is not a state the platform mints. tenant_id is the one owning key, forever (NFR-141).UNIQUE (tenant_id, capacity) bank หรือ government ที่ active ห้าม capacity อื่นที่ active (NFR-16) ต่อท้าย — การเพิกถอนไม่ลบ (v0.45.0 · FR-392 · WF-01 · NFR-141) |
| Person → PersonCapacity | 1 — 0..* | v0.45.0 (PROP-074) — UNIQUE (person_id, capacity); append-only. Zero rows at v1 (R-EMPTY). It owns nothing, isolates nothing and grants NO access; it never founds a tenant. Always compatible — no matrix, no exclusivity.v0.45.0 (PROP-074) — ไม่ซ้ำ (person_id, capacity) เพิ่มอย่างเดียว v1 ไม่มีแถว ไม่เป็นเจ้าของ ไม่ให้สิทธิ์เข้าถึง และไม่ก่อตั้ง tenant |
| Tenant → TenantQualification | 1 — 0..* | v0.45.0 (PROP-074) — the externally-issued credentials a tenant has registered here. UNIQUE (tenant_id, qualification) among active rows. Status follows the issuer, not us (A-79).v0.45.0 (PROP-074) — ตราสารภายนอกที่ tenant ลงทะเบียนไว้ สถานะตามผู้ออก ไม่ใช่ตามเรา (A-79) |
| Person → PersonQualification | 1 — 0..* | v0.45.0 (PROP-074) — the licence a human keeps when he changes employer. UNIQUE (person_id, qualification) among active rows; append-only.v0.45.0 (PROP-074) — ใบอนุญาตที่คนถือติดตัวเมื่อเปลี่ยนนายจ้าง |
| TenantCapacity → TenantQualification | 0..* — 0..* requires | v0.45.0 (PROP-074) — declared on the capacity DEFINITION (capacities[].requires), not row by row, and evaluated at grant and at every re-check. The chain: a qualification lapses or is revoked → every capacity requiring it is suspended → the surfaces they entitle go dormant (FR-393). No capacity may require a qualification its holder cannot hold.v0.45.0 (PROP-074) — ประกาศที่นิยามของ capacity ไม่ใช่รายแถว ประเมินตอนให้และทุกครั้งที่ตรวจซ้ำ ลูกโซ่: qualification หมดอายุ → capacity ที่เรียกร้องถูกระงับ → ช่องทางหลับ (FR-393) |
| Membership → SurfaceRoleGrant | 1 — 0..* | UNIQUE (membership_id, surface) — exactly one role per surface per membership; grants live only on entitled surfaces.UNIQUE (membership_id, surface) — หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ; grant อยู่เฉพาะช่องทางที่มีสิทธิ์ |
| Tenant → RolePermission | 1 — 0..* | The tenant-authored role × permission matrix; the owner role is fixed-full and locked in every matrix.ตาราง role × permission ที่ tenant เขียน; บทบาท owner เต็มถาวรและล็อกในทุกตาราง |
| PermissionCatalog → RolePermission | 1 — 0..* | Tenants compose roles from the platform catalog; scoped rows must be equal-or-narrower than the tenant-wide default.tenant ประกอบบทบาทจาก catalog ของ platform; แถวที่จำกัดต้องเท่าหรือแคบกว่าค่าเริ่มต้นทั้ง tenant |
| Tenant / Person → ViewAsSession | 1 — 0..* | Platform support enters a tenant only via an audited, banner-announced, dual-logged session; the acting person is the RFC 8693 actor; read-only by default.ทีมสนับสนุนเข้า tenant ได้เฉพาะผ่าน session (เซสชัน) ที่ตรวจสอบได้ มีแบนเนอร์ บันทึกสองชั้น; บุคคลที่กระทำคือ RFC 8693 actor; อ่านอย่างเดียวโดยปริยาย |
| Person → PhoneNumber | 1 — 0..* | v0.42.0 (PROP-067) — any number of numbers; UNIQUE (e164) among ACTIVE rows platform-wide (NFR-14 amended) and exactly one active row is primary. None required at sign-up; at least one VERIFIED number from the first membership (FR-365).v0.42.0 (PROP-067) — มีกี่เบอร์ก็ได้; UNIQUE (e164) เฉพาะแถวที่ใช้งานอยู่ทั้งแพลตฟอร์ม (แก้ NFR-14) และมีเบอร์หลักแถวเดียว ตอนสมัครยังไม่ต้องมี; ต้องมีเบอร์ที่ยืนยันแล้วอย่างน้อยหนึ่งเบอร์ตั้งแต่ membership แรก (FR-365) |
| Person → ExternalIdentity | 1 — 0..* | At most one account per provider per person; UNIQUE (provider, provider_subject) platform-wide, so one provider account reaches exactly one person forever. Append-only — unbinding never deletes.หนึ่งบัญชีต่อผู้ให้บริการต่อคน; UNIQUE (provider, provider_subject) ทั้งแพลตฟอร์ม หนึ่งบัญชีไปถึงคนเดียวตลอดไป ต่อท้ายเท่านั้น — การเลิกผูกไม่ลบ |
| Person → Passkey | 1 — 0..* | Any number of passkeys, each labelled by the holder; credential_id UNIQUE platform-wide.มี passkey กี่อันก็ได้ เจ้าของตั้งชื่อเอง; credential_id ไม่ซ้ำทั้งแพลตฟอร์ม |
| Person → DeviceCredential | 1 — 0..* | v0.43.0 (PROP-068) — one row per DEVICE the person can get in on; UNIQUE (person_id, device_key_hash). Revoked by the holder from sec-01, by a factor change, by a completed recovery or with a membership — and revoking it revokes every session it minted. Counts for the FR-368 last-door test and never for the FR-369 different-kind offer (D-8).v0.43.0 (PROP-068) — หนึ่งแถวต่อหนึ่งเครื่องที่บุคคลใช้เข้าได้; UNIQUE (person_id, device_key_hash) ถอนโดยเจ้าของจาก sec-01 โดยการเปลี่ยนปัจจัย โดยการกู้คืน หรือพร้อม membership — และการถอนจะถอนทุกเซสชันที่มันสร้าง นับในการทดสอบประตูสุดท้าย FR-368 ไม่นับในการเสนอทางเข้าต่างชนิด FR-369 (D-8) |
| Person / Tenant → AuthSession | 1 — 0..* | One row per live session naming its device, method and assurance level; active_tenant_id names the tenant it acts as. Removing a Membership revokes exactly those sessions — and nothing else the person owns (FR-366, FR-373).หนึ่งแถวต่อเซสชันที่ยังใช้งาน ระบุอุปกรณ์ วิธี และระดับความเชื่อมั่น; active_tenant_id บอก tenant ที่กระทำในนาม การถอน Membership ยกเลิกเฉพาะเซสชันเหล่านั้น ไม่แตะสิ่งอื่นของเขา (FR-366, FR-373) |
| Person → AuthEvent | 1 — 0..* | Append-only authentication history read by the holder in plain language (FR-374); a staff-assisted act names the officer in actor_person_id (A-71).ประวัติการเข้าใช้แบบเพิ่มเท่านั้น เจ้าของอ่านเป็นภาษาที่เข้าใจง่าย (FR-374); การกระทำโดยเจ้าหน้าที่ระบุชื่อใน actor_person_id (A-71) |
| Person → IdentityCheck | 1 — 0..* | Append-only proofing record (admission or recovery). A passing check writes national_id_hash — unique among verified persons — and may raise id_verified_level; it is never a way in (A-75, FR-372).ระเบียนการพิสูจน์ตัวตนแบบเพิ่มเท่านั้น (รับเข้า หรือกู้คืน) การตรวจที่ผ่านเขียน national_id_hash — ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว — และยก id_verified_level ได้; ไม่ใช่ทางเข้า (A-75, FR-372) |
| Tenant → Farmer / Mill / FinancialInstitution / Contractor | 1 — 0..* | Domain profiles of the tenant (via tenant_id): a Farmer is the grower/quota profile (a virtual farmer's tenant has an unclaimed person); Mill under a mill tenant; FI under a bank tenant; Contractor under a contractor tenant. Deep definitions live in the capacity ERDs.โปรไฟล์ capacityของ tenant (ผ่าน tenant_id): Farmer คือโปรไฟล์ grower/quota (tenant ของเกษตรกร virtual มีบุคคลที่ยังไม่อ้างสิทธิ์); Mill ใต้ tenant mill; FI ใต้ tenant bank; Contractor ใต้ tenant contractor นิยามเชิงลึกอยู่ใน ERD ราย capacity |
v0.54.0 (PROP-078 approved & applied 7 Aug 2026, OQ-2 decided by the client). A Thai document addresses a person by his prefix before it uses his name at all, and the model had no attribute for it — so every generated advice either omitted the form of address or invented one. Person.name_prefix? now names a row of this register, authored in docs/graph/spec-graph.json on the legalForms pattern: data, never a compiled enumeration (A-80 R-DATA). Adding หม่อมหลวง, a military rank or a monastic form is a graph change and a validator run, never a release. Null is ordinary: a person who states no prefix is complete, and no document invents one for him.
v0.54.0 (PROP-078 อนุมัติและ apply 7 ส.ค. 2569, ลูกค้าตัดสิน OQ-2) เอกสารไทยเรียกขานบุคคลด้วยคำนำหน้าก่อนใช้ชื่อเสียอีก และตัวแบบไม่มีแอตทริบิวต์รองรับ ใบแจ้งที่สร้างอัตโนมัติจึงต้องละคำนำหน้าไปหรือไม่ก็คิดขึ้นเอง ตอนนี้ Person.name_prefix? ชี้ไปที่แถวของทะเบียนนี้ ซึ่งเขียนไว้ใน docs/graph/spec-graph.json ตามแบบ legalForms: เป็นข้อมูล ไม่ใช่ enum ที่คอมไพล์ไว้ (A-80 R-DATA) การเพิ่ม หม่อมหลวง ยศทหาร หรือสมณศักดิ์ คือการแก้กราฟและรัน validator ไม่ใช่การออกรุ่น ค่าว่างเป็นเรื่องปกติ: คนที่ไม่ระบุถือว่าครบถ้วน และไม่มีเอกสารใดคิดคำนำหน้าให้เขา
| Row idรหัสแถว | Thaiไทย | Englishอังกฤษ | Used forใช้กับ |
|---|---|---|---|
| mr | นาย | Mr | Adult manชายผู้ใหญ่ |
| mrs | นาง | Mrs | Married woman, and any woman who states itหญิงที่สมรสแล้ว และหญิงที่ระบุเอง |
| miss | นางสาว | Miss | Unmarried womanหญิงที่ยังไม่สมรส |
| master | เด็กชาย | Master | Boy under 15, as the civil registry writes itเด็กชายอายุต่ำกว่า 15 ปี ตามที่ทะเบียนราษฎร์เขียน |
| miss_child | เด็กหญิง | Miss | Girl under 15, as the civil registry writes itเด็กหญิงอายุต่ำกว่า 15 ปี ตามที่ทะเบียนราษฎร์เขียน |
| dr | ดร. | Dr | Doctoral title, stated by the holderคำนำหน้าทางวิชาการ ผู้ถือระบุเอง |
| Today (≤ v5.0)ปัจจุบัน (≤ v5.0) | Becomes (v6.0)กลายเป็น (v6.0) |
|---|---|
| Tenant | Tenant kind = organization — tenant_type maps to the initial TenantCapacity (sugar_factory→mill · quota_org→quota · government_agency→government · bank→bank · contractor→contractor).Tenant kind = organization — tenant_type จับคู่กับ TenantCapacity แรก (sugar_factory→mill · quota_org→quota · government_agency→government · bank→bank · contractor→contractor) |
| User | Person + Membership — duplicate humans across tenants merge on verified phone (assisted, consent-confirmed, logged; FR-69).Person + Membership — มนุษย์ที่ซ้ำข้าม tenant รวมกันบนเบอร์ที่ยืนยัน (แบบช่วย ยืนยันความยินยอม บันทึก; FR-69) |
| *_tenant_type + *_tenant_id | A single tenant_id everywhere (lender, owner, requester, payer, borrower, rater, endorser, grantor, grantee, subject…). The polymorphic pair is gone.เหลือ tenant_id เดียวทุกที่ (ผู้ให้กู้ เจ้าของ ผู้ขอ ผู้จ่าย ผู้กู้ ผู้ให้คะแนน ผู้รับรอง ผู้ให้ ผู้รับ ผู้ถูกประเมิน…) คู่ polymorphic หายไป |
| Virtual cane farmerลูกไร่ virtual | A tenant with an unclaimed person; claiming by phone verification keeps farmer_id and all history — crops, transfers, credit, repayment (WF-01).tenant ที่มีบุคคลยังไม่อ้างสิทธิ์; การอ้างสิทธิ์ด้วยการยืนยันเบอร์คง farmer_id และประวัติทั้งหมด — อ้อย การโอน สินเชื่อ การชำระคืน (WF-01) |
| network_identity contextบริบท | Absorbed into federation; network RELATIONS (quota↔sub-farmer, mill↔quota) stay with their departments as X2 visibility sources.รวมเข้าใน federation; RELATION เครือข่าย (quota↔ลูกไร่, mill↔quota) คงอยู่กับหน่วยงานของตนเป็นแหล่งมองเห็น X2 |
Published here at v0.49.0, and it was not published before. FR-396 has said since v0.47.0 that the specification publishes ONE permanent bidirectional crosswalk and named this document as its home; the rows lived only in the graph, so a reader of the documents could not resolve a retired noun in one lookup. Recorded as F-10 of the pass-4 review and fixed in the same change set. The crosswalk is never retired and never abbreviated: R-ARCHIVE deliberately does not rewrite the drafts archive, so this pointer is the only thing that keeps 101 files readable. A pointer is not permission — NFR-142 refuses the retired words in new text.
เผยแพร่ที่นี่ตั้งแต่ v0.49.0 และก่อนหน้านี้ไม่ได้เผยแพร่ FR-396 ระบุตั้งแต่ v0.47.0 ว่าข้อกำหนดเผยแพร่ตารางแปลงถาวรสองทิศทางหนึ่งชุด และระบุเอกสารฉบับนี้เป็นบ้าน แต่แถวข้อมูลอยู่แต่ในกราฟ ผู้อ่านเอกสารจึงค้นชื่อที่เลิกใช้ในครั้งเดียวไม่ได้ บันทึกเป็น F-10 ของการทบทวนรอบ 4 และแก้ในชุดเดียวกัน ตารางนี้ไม่ถูกยกเลิกและไม่ถูกย่อ เพราะ R-ARCHIVE จงใจไม่เขียนคลังร่างใหม่ ตัวชี้ทางนี้คือสิ่งเดียวที่ทำให้ 101 ไฟล์ยังอ่านได้ ตัวชี้ทางไม่ใช่การอนุญาต — NFR-142 ปฏิเสธคำที่เลิกใช้ในข้อความใหม่
| Retired nameชื่อที่เลิกใช้ | Live nameชื่อที่ใช้ | Sinceตั้งแต่ |
|---|---|---|
| Party | Tenant | v0.47.0 |
| party_id and every prefixed formและทุกรูปที่มีคำนำหน้า (owner_ · active_ · acting_ · subject_ · lender_ · lead_ · payer_ · requester_ · grantee_ · grantor_ · borrower_ · endorser_ · provider_ · target_ · farmer_ · quota_ · holder_ · landlord_ · recipient_ · rater_ · scorer_ · relayed_by_ · declared_by_ · applicant_ · member_) | tenant_id | v0.47.0 |
| PermissionGroup.tenant_party_id · *_party_type | tenant_id · *_tenant_type | v0.47.0 |
| PartyCapacity · PartyQualification · PartyFounded · PartyCreated · PartyContextIssued | TenantCapacity · TenantQualification · TenantFounded · TenantCreated · TenantContextIssued | v0.47.0 |
| party context · party switcher · party_context · cross-party / cross_party / crossParty · representative party · tenant root | tenant context · tenant switcher · tenant_context · cross-tenant / cross_tenant / crossTenant · representative tenant · root tenant (parent is nullไม่มีแม่) | v0.47.0 |
| organisation · an organization party / an individual partyparty แบบองค์กร / แบบบุคคล · ผู้เล่น · องค์กร | organization · a tenant (there are no kinds — the enum was retired by PROP-075)tenant (ไม่มีชนิด — enum ถูกเลิกใช้โดย PROP-075) · tenant | v0.47.0 |
| the government capacity · the fund capacitycapacity government · capacity fund | the ocsb capacity · the ocsf capacitycapacity ocsb · capacity ocsf | v0.47.0 |
| PTY-######## · PCA-######## · PQL-######## · claimclaim pty · claimclaim dom | TNT-######## · TCA-######## · TQL-######## · tnt · dep | v0.47.1 |
| quota_org_officer · lead_org_officer | quota_officer · lead_officer | v0.47.2 |
| Quota-organization officer · quota-org officer · Organization officer · เจ้าหน้าที่องค์กรโควตา · quota organization (naming the tenant)องค์กรโควตา (เรียก tenant) | Quota officer · เจ้าหน้าที่โควตา · quota groupกลุ่มโควตา | v0.47.3 |
| Domain · domain_id · parent_domain_id · domain_path · site domainโดเมนประจำสถานที่ · domain treeต้นไม้โดเมน · DomainCreated · DomainReparented · grp.dir.domainSwitch · โดเมน (the organizational unitในความหมายหน่วยงาน) | Department · department_id · parent_department_id · department_path · site departmentหน่วยงานประจำสถานที่ · department treeต้นไม้หน่วยงาน · DepartmentCreated · DepartmentReparented · grp.dir.departmentSwitch · หน่วยงาน (Domain.kind = site became Site, A-83)(Domain.kind = site กลายเป็น Site, A-83) | v0.46.0 · confirmedยืนยัน v0.49.0 |
HELD — these contain the letters and are not the word (A-84, and the hold list is part of the rule): counterparty / counterparties / คู่สัญญา · third party / third-party (a PDPA term of art) · tripartite working group (the statutory grower/mill/OCSB body) · PersonCapacity / PersonQualification / person_id · Person · Membership · capacity · surface · role · quoted external sources and legal citations. And for the fourth noun, the whole DDD sense is held: domain event · domain service · domain boundary · domain profile · domain term · Domain-Driven Design · ตรรกะโดเมน, plus the Active-Directory reference model quoted at PROP-026 and a hostname column. WITHDRAWN rows, recorded so the absence is deliberate: Party.kind = organization → Tenant.kind = company (the enum no longer exists to rename) and PartyUpgradedToOrganization → TenantUpgradedToCompany (the event was retired for DepartmentRegistered).
คงไว้ — มีตัวอักษรเดียวกันแต่ไม่ใช่คำเดียวกัน (A-84 รายการห้ามแตะเป็นส่วนหนึ่งของกฎ): counterparty / counterparties / คู่สัญญา · third party (ศัพท์เฉพาะ PDPA) · tripartite working group (คณะทำงานสามฝ่ายตามกฎหมาย) · PersonCapacity / PersonQualification / person_id · Person · Membership · capacity · surface · role · แหล่งอ้างอิงภายนอกและการอ้างกฎหมาย และสำหรับคำที่สี่ ความหมายเชิง DDD คงไว้ทั้งหมด: domain event · domain service · domain boundary · domain profile · domain term · Domain-Driven Design · ตรรกะโดเมน รวมถึงแบบอ้างอิง Active Directory ที่ยกมาใน PROP-026 และคอลัมน์ชื่อโฮสต์ แถวที่ถอนออก บันทึกไว้ว่าจงใจไม่มี: Party.kind = organization (ไม่มี enum ให้เปลี่ยนชื่อแล้ว) และ PartyUpgradedToOrganization (event ถูกเลิกใช้แทนด้วย DepartmentRegistered)
Normative physical model for the 19 entities homed in this document, rendered from the graph's dataModeling block. Types derive from typeConventions (first rule wins): money = bigint satang · weights = integer kg · tonnage = numeric(12,3) · timestamps = timestamptz UTC · ids = uuid v7. Every FK is indexed by convention (ON DELETE RESTRICT); listed indexes are additional. Enum value sets live in the graph's entity and state-machine notes.
Model เชิงกายภาพที่เป็นบรรทัดฐานของ entity ทั้ง 19 รายการที่ home อยู่ในเอกสารนี้ render จาก block dataModeling ใน graph ชนิดข้อมูลอนุมานจาก typeConventions (กติกาแรกที่เข้าเป็นผล): เงิน = bigint สตางค์ · น้ำหนัก = integer กก. · ตัน = numeric(12,3) · เวลา = timestamptz UTC · id = uuid v7 ทุก FK มี index ตามข้อตกลง (ON DELETE RESTRICT); index ที่ระบุคือส่วนเพิ่ม ชุดค่า enum อยู่ในหมายเหตุ entity และ state machine ของ graph
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| person_id | uuid | — | uuid_v7() | PK |
| name_prefix | text (namePrefixes row id) | ✓ | null | Register row, never free text (FR-437 R-PREFIX) |
| first_name | text | ✓ | — | Written with last_name, birth_date and province when the profile step completes (FR-437) |
| last_name | text | ✓ | — | Required at completion, no published exception (OQ-3) |
| nickname | text | ✓ | — | ชื่อเล่น · the form of address in the app, never on a document (FR-437 R-NICKNAME) |
| birth_date | date | ✓ | — | Declared, entered in พ.ศ. · never an authentication factor (FR-439, A-75) |
| province | smallint | ✓ | — | PROP-047 registry code · picked, never typed (FR-438) |
| amphor | smallint | ✓ | — | PROP-047 · optional at every depth (R-CASCADE) |
| tumboon | integer | ✓ | — | PROP-047 · optional at every depth (R-CASCADE) |
| text | ✓ | — | ||
| email_verified | boolean | ✓ | — | |
| national_id_hash | char(64) | ✓ | — | |
| id_verified_level | text (enum) | — | — | |
| status | text (enum) | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| phone_number_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| e164 | varchar(16) | — | — | UNIQUE (active) |
| label | varchar(32) | ✓ | — | |
| is_primary | boolean | — | false | |
| verified | boolean | — | false | |
| verified_at | timestamptz | ✓ | — | |
| added_at | timestamptz | — | now() | |
| added_via | text (enum: signup | settings_add | mill_registration | recovery) | — | — | |
| last_used_at | timestamptz | ✓ | — | |
| status | text (enum: active | removed) | — | active | |
| removed_at | timestamptz | ✓ | — | |
| removed_reason | text | ✓ | — | |
| reusable_after | timestamptz | ✓ | — | cooling periodระยะพัก |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| external_identity_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| provider | text (enum: google | apple | line | facebook) | — | — | |
| provider_subject | varchar(255) | — | — | UNIQUE with provider |
| provider_email | varchar(320) | ✓ | — | display only — never indexedแสดงผลเท่านั้น ไม่เป็นดัชนี |
| provider_email_verified | boolean | — | false | |
| display_hint | varchar(64) | — | — | maskedปิดบางส่วน |
| bound_at | timestamptz | — | now() | |
| bound_via | text (enum: signup | settings_add | recovery) | — | — | |
| bound_from_session | uuid | ✓ | — | → auth_session |
| last_used_at | timestamptz | ✓ | — | |
| status | text (enum: active | unbound) | — | active | |
| unbound_at | timestamptz | ✓ | — | |
| unbound_reason | text | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| passkey_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| credential_id | bytea | — | — | UNIQUE |
| public_key | bytea | — | — | |
| sign_count | bigint | — | 0 | |
| aaguid | uuid | ✓ | — | |
| transports | jsonb | — | '[]' | |
| backup_eligible | boolean | — | — | recorded, never used to refuseบันทึก ไม่ใช้ปฏิเสธ |
| backup_state | boolean | — | — | |
| label | varchar(64) | — | — | holder-authoredเจ้าของตั้งเอง |
| created_at | timestamptz | — | now() | |
| created_from_session | uuid | — | — | → auth_session |
| last_used_at | timestamptz | ✓ | — | |
| status | text (enum: active | revoked) | — | active | |
| revoked_at | timestamptz | ✓ | — | |
| revoked_reason | text | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| credential_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| device_key_hash | bytea | — | — | UNIQUE (with person_id)(คู่กับ person_id) |
| public_key | bytea | — | — | |
| key_alg | text (enum: es256 | rs256) | — | es256 | |
| hardware_backed | boolean | — | — | recorded, never used to refuse; raises the AAL onlyบันทึก ห้ามใช้ปฏิเสธ; ใช้ยก AAL เท่านั้น |
| user_verification | text (enum: device_biometric | device_screenlock | app_pin) | — | — | the one ACTUALLY used (D-10)ค่าที่ใช้จริง (D-10) |
| device_label | varchar(64) | — | — | holder-authoredเจ้าของตั้งเอง |
| device_hint | varchar(64) | — | — | maskedปิดบัง |
| enrolled_at | timestamptz | — | now() | |
| enrolled_via | text (enum: signup | otp_enrolment | existing_session | recovery | staff_assisted) | — | — | |
| enrolment_reversible_until | timestamptz | ✓ | — | published seven-day window (FR-380)ช่วงเจ็ดวันที่ประกาศไว้ (FR-380) |
| last_used_at | timestamptz | ✓ | — | |
| status | text (enum: active | revoked | expired) | — | active | |
| revoked_at | timestamptz | ✓ | — | |
| revoke_reason | text (enum: holder | factor_change | recovery | capacity_revoked | membership_removed | expiry) | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| identity_check_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| purpose | text (enum: admission | recovery) | — | — | |
| method | text (enum: id_card_liveness) | — | — | |
| document_kind | text (enum: national_id) | — | — | |
| document_ref | varchar(64) | — | — | masked reference — never the imageอ้างอิงแบบปิดบัง ไม่ใช่ภาพ |
| liveness_result | text (enum: pass | fail | inconclusive) | — | — | |
| match_score | numeric(5,2) | ✓ | — | |
| card_birth_date | date | ✓ | — | read off the card front by the same OCR pass · null where the read failedอ่านจากหน้าบัตรโดย OCR รอบเดียวกัน · ว่างเมื่ออ่านไม่ได้ |
| birth_date_match | text (enum: match | mismatch | not_read) | ✓ | — | the comparison against person.birth_date — recorded, never acted on silently (FR-439)ผลเทียบกับ person.birth_date — บันทึกไว้ ไม่ตัดสินแทนโดยเงียบ (FR-439) |
| national_id_hash | char(64) | — | — | → person.national_id_hash |
| result | text (enum: passed | failed) | — | — | |
| checked_at | timestamptz | — | now() | |
| checked_by | uuid | ✓ | — | → membership |
| vendor_ref | varchar(128) | ✓ | — | |
| consent_ref | uuid | — | — | explicit, separable PDPA consentความยินยอมโดยชัดแจ้งแยกรายการ |
| evidence_retained_until | timestamptz | — | — | image + template deleted hereลบภาพและ template ที่นี่ |
| status | text (enum: active | evidence_purged) | — | active |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| session_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| active_tenant_id | uuid | — | — | → tenant |
| active_department_id | uuid | ✓ | — | → department |
| device_label | varchar(64) | — | — | |
| auth_method | text (enum: provider | passkey | device_key) · RETIRED member: phone_otp· สมาชิกที่ยกเลิก: phone_otp | — | — | amr v0.43.0 — no new session is ever minted from a code (FR-377)v0.43.0 — ไม่มีเซสชันใหม่ใดสร้างจากรหัส (FR-377) |
| aal | text (enum: aal1 | aal2) | — | — | aal |
| created_at | timestamptz | — | now() | |
| last_seen_at | timestamptz | — | now() | |
| expires_at | timestamptz | — | — | |
| revoked_at | timestamptz | ✓ | — | |
| revoked_by | uuid | ✓ | — | → person |
| revoke_reason | text (enum: holder | factor_change | recovery | capacity_revoked | membership_removed | expiry) | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| auth_event_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | → person |
| kind | text (enum: sign_in | sign_in_failed | factor_bound | factor_unbound | number_added | number_removed | primary_number_changed | recovery_started | recovery_completed | recovery_reversed | identity_checked | session_revoked | step_up | challenge_raised | challenge_passed | challenge_failed | device_enrolled | device_enrolment_reversed) | — | — | five kinds added v0.43.0 (PROP-068)เพิ่มห้าชนิด v0.43.0 (PROP-068) |
| method | text (enum: phone_otp | provider | passkey | staff_assisted | id_card_liveness) | — | — | |
| result | text (enum: ok | refused | throttled) | — | — | |
| risk_signals | jsonb | — | '[]' | v0.43.0 — the published signal(s) that raised a challenge (FR-382); empty on a non-challenge eventv0.43.0 — สัญญาณที่ประกาศไว้ซึ่งยกด่านขึ้น (FR-382); ว่างเมื่อไม่ใช่เหตุการณ์ด่าน |
| session_id | uuid | ✓ | — | → auth_session |
| actor_person_id | uuid | ✓ | — | → person (the officer, A-71)(เจ้าหน้าที่ A-71) |
| device_hint | varchar(64) | — | — | |
| ip_country | char(2) | — | — | |
| at | timestamptz | — | now() |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| tenant_id | uuid | — | uuid_v7() | PK |
| kind | text (enum) | — | — | |
| display_name | text | — | — | |
| legal_name | text | ✓ | — | |
| registration_no | text | ✓ | — | |
| base_province | smallint | — | — | Province enum · TIS 1099-2548 (PROP-047) |
| representation | text (enum) | — | — | |
| stewarded_by | uuid | ✓ | — | FK → tenant |
| status | text (enum) | — | — | |
| created_at | timestamptz | — | now() |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| capacity_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| capacity | text (enum) | — | — | |
| admission | text (enum) | — | — | |
| invitation_id | uuid | ✓ | — | FK → invitation |
| status | text (enum) | — | — | |
| required_level | text (enum) | — | — | |
| verified_by | uuid | ✓ | — | FK → membership |
| evidence_ref | text | ✓ | — | |
| granted_at | timestamptz | — | — | |
| suspended_at | timestamptz | ✓ | — | |
| revoked_at | timestamptz | ✓ | — |
v0.45.0 (PROP-074) — the applied TenantCapacity column list with tenant_id → person_id and one addition, expires_at: same contract, same names, one switched key. person_id is NOT NULL and carries a foreign key — the invariant that rules out a single shared standing table with two nullable holder columns, without naming an ORM or a mapping strategy (NFR-141). Zero rows at v1 (R-EMPTY).
v0.45.0 (PROP-074) — รายการคอลัมน์ของ TenantCapacity ที่ apply แล้ว โดยเปลี่ยน tenant_id → person_id และเพิ่ม expires_at person_id เป็น NOT NULL และมี foreign key (NFR-141) v1 ไม่มีแถวเลย
| Columnคอลัมน์ | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refคีย์ / อ้างอิง |
|---|---|---|---|---|
| capacity_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | FK → person |
| capacity | text (enum) | — | — | — |
| admission | text (enum) | — | — | — |
| invitation_id | uuid | ✓ | — | FK → invitation |
| status | text (enum) | — | — | — |
| required_level | text (enum) | — | — | — |
| verified_by | uuid | ✓ | — | FK → membership |
| evidence_ref | text | ✓ | — | — |
| granted_at | timestamptz | — | — | — |
| expires_at | date | ✓ | — | — |
| suspended_at | timestamptz | ✓ | — | — |
| revoked_at | timestamptz | ✓ | — | — |
v0.45.0 (PROP-074) — the externally-issued credential a tenant has registered here: seven of the eight applied qualifications. expires_at is indexed because that is the whole point of the entity — while these lived as prose no scheduler could find a group about to lapse and no query could answer "which tenants are one month from suspension" (FR-393).
v0.45.0 (PROP-074) — ตราสารที่ออกจากภายนอกซึ่ง tenant ลงทะเบียนไว้ที่นี่ เจ็ดในแปดตัวที่ apply แล้ว expires_at ถูกทำดัชนีเพราะนั่นคือเหตุผลทั้งหมดของเอนทิตีนี้ (FR-393)
| Columnคอลัมน์ | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refคีย์ / อ้างอิง |
|---|---|---|---|---|
| qualification_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| qualification | text (enum) | — | — | — |
| issuer | text | — | — | — |
| issuer_ref | text | ✓ | — | — |
| status | text (enum) | — | — | registered | verified | expired | revoked | refused |
| verified_by | uuid | ✓ | — | FK → membership |
| evidence_ref | text | ✓ | — | — |
| issued_at | date | — | — | — |
| registered_at | timestamptz | — | — | — |
| expires_at | date | ✓ | — | — |
| revoked_at | timestamptz | ✓ | — | — |
v0.45.0 (PROP-074) — the licence a human keeps when he changes employer. One applied member: national_id, written by IdentityCheck (purpose = admission) and cached on Person.id_verified_level — which is why half the mechanism was already person-shaped. pdpa: personal; evidence retention follows the PROP-067 D-13 discipline.
v0.45.0 (PROP-074) — ใบอนุญาตที่คนถือติดตัวเมื่อเปลี่ยนนายจ้าง สมาชิกที่ apply แล้วหนึ่งตัวคือ national_id เขียนโดย IdentityCheck และแคชที่ Person.id_verified_level
| Columnคอลัมน์ | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refคีย์ / อ้างอิง |
|---|---|---|---|---|
| qualification_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | FK → person |
| qualification | text (enum) | — | — | — |
| issuer | text | — | — | — |
| issuer_ref | text | ✓ | — | — |
| status | text (enum) | — | — | registered | verified | expired | revoked | refused |
| verified_by | uuid | ✓ | — | FK → membership |
| evidence_ref | text | ✓ | — | — |
| issued_at | date | — | — | — |
| registered_at | timestamptz | — | — | — |
| expires_at | date | ✓ | — | — |
| revoked_at | timestamptz | ✓ | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| membership_id | uuid | — | uuid_v7() | PK |
| person_id | uuid | — | — | FK → person |
| tenant_id | uuid | — | — | FK → tenant |
| is_self | boolean | — | — | |
| title | text | ✓ | — | |
| status | text (enum) | — | — | |
| invited_by | uuid | ✓ | — | FK → membership |
| joined_at | timestamptz | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| invitation_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| department_path | text | — | — | the department the position sits in (one scope axis, A-82)หน่วยงานที่ตำแหน่งอยู่ (แกนขอบเขตเดียว A-82) |
| permission_group_id | uuid | — | — | FK → permission_group |
| surface_roles | jsonb | — | — | the SurfaceRoleGrants acceptance will write, one role per surfaceSurfaceRoleGrant ที่การตอบรับจะเขียน หนึ่งบทบาทต่อช่องทาง |
| target_kind | text (enum: phone | provider_email) | — | phone | |
| target_hash | bytea | — | — | hashed, either kind — a leaked table is not a phone bookเก็บแบบแฮชทั้งสองชนิด ตารางที่รั่วไม่ใช่สมุดโทรศัพท์ |
| issued_by | uuid | — | — | FK → membership |
| token_hash | bytea | — | — | UNIQUE |
| expires_at | timestamptz | — | now() + 7 days | published on the invitation (FR-397)ประกาศบนคำเชิญ (FR-397) |
| status | text (enum: issued | accepted | declined | expired | revoked) | — | issued | |
| accepted_by_person_id | uuid | ✓ | — | FK → person |
| accepted_at | timestamptz | ✓ | — | no declined_at exists for the issuer to read (OQ-6)ไม่มี declined_at ให้ผู้ออกอ่าน (OQ-6) |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| referral_id | uuid | — | uuid_v7() | PK |
| referrer_person_id | uuid | — | — | FK → person · UNIQUE |
| code | text (8 chars) | — | — | UNIQUE — reduced alphabet, 7 of payload + 1 check character, read 4 + 4ชุดอักขระที่ตัดตัวสับสนออก เนื้อหา 7 ตัว หลักตรวจสอบ 1 ตัว อ่านเป็น 4 + 4 |
| status | text (enum: active | paused | revoked) | — | active | |
| opens_count | integer | — | 0 | a count, never a list (FR-411)เป็นจำนวน ไม่ใช่รายชื่อ (FR-411) |
| campaign_id | uuid | ✓ | — | set only for a seeded communicator (W-6)มีค่าเฉพาะผู้บอกต่อที่วางไว้ (W-6) |
| created_at | timestamptz | — | now() | |
| paused_at | timestamptz | ✓ | — | by the holderโดยเจ้าของรหัส |
| revoked_at | timestamptz | ✓ | — | by the platform, for abuse (Y-13)โดยแพลตฟอร์ม เมื่อมีการใช้ผิด (Y-13) |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| credit_id | uuid | — | uuid_v7() | PK |
| referral_id | uuid | ✓ | — | FK → referral — NULL on a declineว่างเมื่อปฏิเสธ |
| referred_person_id | uuid | — | — | FK → person · UNIQUE — asked once in a lifetimeถามครั้งเดียวในชีวิต |
| basis | text (enum: plot_registered | delivery_recorded | declined) | — | — | the one real act, or the decline (FR-412)การกระทำจริงหนึ่งอย่าง หรือการปฏิเสธ (FR-412) |
| confirmed_at | timestamptz | — | now() |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| grant_id | uuid | — | uuid_v7() | PK |
| membership_id | uuid | — | — | FK → membership |
| surface | text (enum) | — | — | |
| department_id | uuid | — | — | FK → department |
| role_id | text (role key) | — | — | |
| granted_by | uuid | — | — | FK → membership |
| granted_at | timestamptz | — | — | |
| status | text (enum) | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| permission_id | uuid | — | uuid_v7() | PK |
| surface | text (enum) | — | — | |
| group | text (permission group) | — | — | |
| key | text (permission key) | — | — | |
| name_th | text | — | — | |
| name_en | text | — | — | |
| description | text | ✓ | — | |
| department_delegable | boolean | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| role_permission_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| role_id | text (role key) | — | — | |
| permission_id | uuid | — | — | FK → permission_catalog |
| allowed | boolean | — | — | |
| scope_type | text (enum) | ✓ | — | |
| scope_ref | text (department path | id) | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| session_id | uuid | — | uuid_v7() | PK |
| target_tenant_id | uuid | — | — | FK → tenant |
| actor_person_id | uuid | — | — | FK → person |
| reason | text | — | — | |
| read_only | boolean | — | — | |
| started_at | timestamptz | — | — | |
| ended_at | timestamptz | ✓ | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| season_id | uuid | — | uuid_v7() | PK |
| label | text | — | — | |
| opens_at | timestamptz | — | — | |
| closes_at | timestamptz | — | — | |
| price_formula_ver | text | — | — |
v0.46.0, PROP-075 approved & applied 3 Aug 2026 — the BUSINESS UNIT, merging the retired department and legal_entity tables. Aggregate root Department, context federation.
| Columnคอลัมน์ | Typeชนิด | NullNull | Defaultค่าตั้งต้น | Notesหมายเหตุ |
|---|---|---|---|---|
| department | ||||
| department_id | uuid | — | — | PK · immutable identity; renaming never changes it |
| tenant_id | uuid | — | — | FK → tenant |
| parent_department_id | uuid | ✓ | — | FK → department · ADMINISTRATIVE containment, single-parent, acyclic — never the cap table (R-NOTCAPTABLE); null on the root (R-ROOT) |
| department_path | ltree (department path) | — | — | UNIQUE tenant-wide · recomputed for the subtree on re-parent (DR-6) |
| legal_form | text (legalForms row id) | ✓ | null | null = an internal ฝ่าย / กอง / region, the common case · otherwise one row of the legalForms register (A-80) |
| legal_name | text | ✓ | — | What the registrar calls this body · meaningful only where legal_form is set |
| registration_no | text (per legalForms row) | ✓ | — | Format comes from the form row — a DBD 13, a cooperative number, a community-enterprise code, or absent for a body established by statute |
| tax_id | text (RD 13) | ✓ | — | The near-universal key: juristic persons, cooperatives and state bodies all carry one |
| entity_role | text (enum) | ✓ | — | operating | holding | parent |
| status | text (enum) | — | live | Live rows are the ones the partial uniques bind; a closed row keeps its number as history |
| uniques | (department_path) · PARTIAL (legal_form, registration_no) and (tax_id) WHERE legal_form IS NOT NULL AND status = live — one live department per registration, transferable by a recorded operator act (OQ-5, OQ-7) | |||
v0.46.0, PROP-075 approved & applied 3 Aug 2026 — the PHYSICAL LOCATION axis. A department may not be given an address and a site may not be given a parent.
| Columnคอลัมน์ | Typeชนิด | NullNull | Defaultค่าตั้งต้น | Notesหมายเหตุ |
|---|---|---|---|---|
| site | ||||
| site_id | uuid | — | — | PK |
| tenant_id | uuid | — | — | FK → tenant · exactly ONE owning tenant (NFR-141) |
| name | text | — | — | |
| site_kind | text (siteKinds row id) | — | — | mill | transfer | office | warehouse | yard | other — a DATA register (A-80) |
| address | text | — | — | The OPERATING address; the registered address is evidence on the registration, not a column here |
| province_code | smallint (province code) | — | — | Receives the location base_province held on entities that have none |
| geo | point | ✓ | — | |
| mill_id | uuid | ✓ | — | FK → mill · UNIQUE where not null — a mill IS at exactly one site |
| status | text (enum) | — | live | |
| shape | FLAT — no parent column and no children, because a place does not contain a place in any sense this platform needs (A-83, R-SITE). Never a legal body, never a permission scope. Aggregate root Site. | |||
v0.46.0, PROP-075 approved & applied 3 Aug 2026 — PRESENCE, many-to-many (R-PRESENCE). Zero is valid on both sides. Commits inside the Department boundary. An operational convenience, NOT a security surface — it scopes nothing.
| Columnคอลัมน์ | Typeชนิด | NullNull | Defaultค่าตั้งต้น | Notesหมายเหตุ |
|---|---|---|---|---|
| department_site | ||||
| department_id | uuid | — | — | FK → department · PK part |
| site_id | uuid | — | — | FK → site · PK part |
| is_primary | boolean | — | false | One per department — the operating address a document prints (OQ-14) |
| status | text (enum) | — | live | A transfer that leaves a shared site behind CLOSES the row rather than moving it |
| uniques | (department_id, site_id) among live rows · PARTIAL (department_id) WHERE is_primary | |||
One row per entity in this perspective. Mutability: mutable · immutable_
หนึ่งแถวต่อ entity ในมุมมองนี้ Mutability: mutable · immutable_
| Entity | Tableตาราง | PK | Unique | Key indexesIndex หลัก | Mutability | PDPA | Profile |
|---|---|---|---|---|---|---|---|
| Person | person | person_id | (national_id_hash — partial: verified persons) | — | mutable | personal | Section 7ข้อ 7 |
| PhoneNumber | phone_number | phone_number_id | (e164 — active) (person_id — primary, active) | (person_id,status) (e164) (reusable_after) | mutable | personal | Section 7ข้อ 7 |
| ExternalIdentity | external_identity | external_identity_id | (provider,provider_subject) | (person_id,status) (person_id,provider) (person_id,last_used_at) | append_ | personal | Section 7ข้อ 7 |
| Passkey | passkey | passkey_id | (credential_id) | (person_id,status) (person_id,last_used_at) | mutable | personal | Section 7ข้อ 7 |
| DeviceCredential | device_credential | credential_id | (person_id,device_key_hash) | (person_id,status) (person_id,last_used_at) (enrolment_reversible_until) | mutable | personal | |
| IdentityCheck | identity_check | identity_check_id | — | (person_id,checked_at) (national_id_hash) (purpose,result) (evidence_retained_until) | append_ | consent_ | Section 7ข้อ 7 |
| AuthSession | auth_session | session_id | — | (person_id,revoked_at) (person_id,last_seen_at) (active_tenant_id) (expires_at) | mutable | personal | Section 7ข้อ 7 |
| AuthEvent | auth_event | auth_event_id | — | (person_id,at) (kind,at) (session_id) | append_ | confidential_ | Section 7ข้อ 7 |
| Tenant | tenant | tenant_id | — | (kind,status) (stewarded_by) (representation (partial: representative)) | mutable | personal | Section 7ข้อ 7 |
| TenantCapacity | tenant_capacity | capacity_id | (tenant_id,capacity) | (capacity,status) | mutable | operational | Section 7ข้อ 7 |
| Membership | membership | membership_id | (person_id,tenant_id) | (tenant_id,status) | mutable | personal | Section 7ข้อ 7 |
| SurfaceRoleGrant | surface_role_grant | grant_id | (membership_id,surface,department_id) | (role_id) (department_id) | mutable | operational | Section 7ข้อ 7 |
| PermissionCatalog | permission_catalog | permission_id | (surface,key) | — | reference | operational | Section 7ข้อ 7 |
| RolePermission | role_permission | role_permission_id | (tenant_id,role_id,permission_id,scope_type,scope_ref) | — | mutable | operational | Section 7ข้อ 7 |
| ViewAsSession | view_as_session | session_id | — | (target_tenant_id,started_at) (actor_person_id) | immutable_ | personal | Section 7ข้อ 7 |
| Season | season | season_id | (label) | — | reference | public | Section 7ข้อ 7 |
Transaction boundaries touching this perspective, from graph dataModeling.aggregates. Inside a boundary the stated invariants commit atomically in one database transaction; across boundaries effects flow through domain events (eventual consistency). Repository and unit-of-work lifetimes for these aggregates are specified in the sibling SPEC-DDD document (scoped per request — see the component lifetime map).
ขอบเขต transaction ที่เกี่ยวกับมุมมองนี้ จาก dataModeling.aggregates ใน graph ภายในขอบเขต invariant ที่ระบุ commit แบบ atomic ใน database transaction เดียว; ข้ามขอบเขตผลไหลผ่าน domain event (eventual consistency) lifetime ของ repository และ unit of work ของ aggregate เหล่านี้กำหนดในเอกสาร SPEC-DDD พี่น้อง (scoped ต่อคำขอ — ดูผัง lifetime ของ component)
| Aggregate root | Membersสมาชิก | Context | Transaction ruleกติกา transaction |
|---|---|---|---|
| Person | Person · PhoneNumber · ExternalIdentity · Passkey · DeviceCredential | federation | Identity facts change in single-row transactions; claiming a virtual tenant's person keeps person_id and every reference intact (WF-01). v0.42.0 (PROP-067): the person’s WAYS IN live inside this boundary — a number, a provider account and a passkey commit with the person, which is where the invariants hold: exactly one active primary number, uniqueness of an active e164 and of (provider, provider_subject) platform-wide, and the refusal to remove the last remaining way in (FR-364, FR-368). Binding and unbinding are personal acts, never delegated (FR-367).ข้อเท็จจริงด้านอัตลักษณ์ (โทรศัพท์ ระดับการยืนยัน) เปลี่ยนใน transaction รายแถว; การ claim person ของ tenant ที่เป็น virtual คง person_id และการอ้างอิงทั้งหมด (WF-01) (v0.42.0 · FR-364 · FR-368 · FR-367) |
| Tenant | Tenant · TenantCapacity · Membership · SurfaceRoleGrant · RolePermission | federation | Capacity grants, memberships and role grants commit atomically with the tenant; capacity exclusivity (NFR-16) and one-role-per-surface-per-membership hold inside this boundary. Written only via the account surface — federation is the sole identity writer.การให้ capacity, membership และ role commit พร้อม tenant ใน transaction เดียว; ความ exclusive ของ capacity (NFR-16) และหนึ่ง role ต่อ surface ต่อ membership ถูกยึดในขอบเขตนี้ เขียนได้ทาง surface account เท่านั้น — federation เป็นผู้เขียนอัตลักษณ์รายเดียว v0.45.0 (PROP-074) — tenant_id is the ONE owning key and nothing else ever owns (NFR-141); the tenant exists because a capacity was requested (FR-392). |
| PersonCapacity | PersonCapacity | federation | v0.45.0 (PROP-074) — a person-held capacity is its OWN single-row boundary on the person; it never commits inside the Tenant boundary, which is what keeps R-QUAL structurally true: a standing that owns nothing must not ride a transaction that owns something. Zero rows at v1.v0.45.0 (PROP-074) — capacity ที่บุคคลถือเป็นขอบเขตรายแถวของตัวเองบนบุคคล ไม่ commit ภายในขอบเขตของ Tenant v1 ไม่มีแถวเลย |
| TenantQualification | TenantQualification | federation | v0.45.0 (PROP-074) — an externally-issued credential is its own single-row boundary: its status follows its ISSUER, not any platform transaction. The consequence — suspending every capacity that requires it — travels as a domain event, never as a shared transaction (FR-393).v0.45.0 (PROP-074) — ตราสารที่ออกจากภายนอกเป็นขอบเขตรายแถวของตัวเอง สถานะตามผู้ออก ผลที่ตามมาเดินทางเป็น domain event เสมอ (FR-393) |
| PersonQualification | PersonQualification | federation | v0.45.0 (PROP-074) — the same boundary on the person side. One member at v1: the national ID credential, written by IdentityCheck (purpose = admission) and cached on Person.id_verified_level.v0.45.0 (PROP-074) — ขอบเขตเดียวกันฝั่งบุคคล v1 มีสมาชิกเดียวคือบัตรประชาชน |
| AuthSession | AuthSession | federation | v0.42.0 (PROP-067) — a session is its own boundary: minted in one transaction naming its device, method, assurance level and tenant context, and revoked in one. Wholesale revocation (a factor change, a completed recovery, a capacity or membership removal) revokes every OTHER session of the person inside the transaction that caused it (FR-373).v0.42.0 (PROP-067) — เซสชันเป็นขอบเขตของตัวเอง: ออกใน transaction เดียวโดยระบุอุปกรณ์ วิธี ระดับความเชื่อมั่น และ tenant context และยกเลิกใน transaction เดียว การยกเลิกทั้งชุดยกเลิกทุกเซสชันอื่นของบุคคลนั้นใน transaction ที่เป็นเหตุ (FR-373) |
| AuthEvent | AuthEvent | federation | v0.42.0 (PROP-067) — append-only log, one row per authentication fact, never updated and never deleted; written inside the transaction of the act it records, so a binding without its event is a failed binding (FR-367).v0.42.0 (PROP-067) — บันทึกแบบเพิ่มเท่านั้น หนึ่งแถวต่อหนึ่งข้อเท็จจริง ไม่แก้ ไม่ลบ; เขียนใน transaction ของการกระทำที่บันทึก การผูกที่ไม่มีเหตุการณ์คือการผูกที่ล้มเหลว (FR-367) |
| IdentityCheck | IdentityCheck | federation | v0.42.0 (PROP-067) — append-only proofing record: a passing check writes Person.national_id_hash (unique among verified persons) and may raise id_verified_level in the same transaction, while the biometric evidence is a separate lifecycle that ENDS at evidence_retained_until and the result row survives (D-13). A check never mints a session (A-75).v0.42.0 (PROP-067) — ระเบียนการพิสูจน์ตัวตนแบบเพิ่มเท่านั้น: การตรวจที่ผ่านเขียน Person.national_id_hash (ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว) และยก id_verified_level ได้ใน transaction เดียวกัน ขณะที่หลักฐานชีวมิติมีวงจรชีวิตแยกซึ่งจบที่ evidence_retained_until และแถวผลลัพธ์ยังอยู่ (D-13) การตรวจไม่ออกเซสชัน (A-75) |
| ViewAsSession | ViewAsSession | federation | Audit record — one row per session; only ended_at may be set after start.ระเบียนตรวจสอบ — หนึ่งแถวต่อ session; แก้ได้เฉพาะ ended_at หลังเริ่ม |
| Season | Season | quota_planning | Reference root; opening/closing a season is operator-governed configuration.root อ้างอิง; การเปิด/ปิดฤดูเป็นการตั้งค่าภายใต้ operator |
| PermissionCatalog | PermissionCatalog | federation | Reference catalogue — operator-governed rows; consumed read-only via the singleton cache.บัญชีอ้างอิง — แถวภายใต้ operator; อ่านอย่างเดียวผ่าน cache แบบ singleton |
| Concernเรื่อง | Contractสัญญา |
|---|---|
| Uniquenessความไม่ซ้ำ | Department UNIQUE (department_path) · PARTIAL and LIVE-ONLY at v0.46.0, PROP-075 approved & applied 3 Aug 2026: UNIQUE (legal_form, registration_no) and UNIQUE (tax_id) WHERE legal_form IS NOT NULL AND status = live — the pair rather than the number, because the same digits from two registrars are two different bodies, and live-only because a mill that changes hands must be a recorded TRANSFER with a history rather than a blocked row (OQ-5, OQ-7). An internal department (legal_form null) participates in neither. Site UNIQUE (mill_id) where not null · DepartmentSite UNIQUE (department_id, site_id) among live rows and one is_primary per department · SurfaceRoleGrant UNIQUE (membership_id, surface, department_id) · DirectoryGroup UNIQUE (tenant_id, name).Department UNIQUE (department_path) · แบบบางส่วนและเฉพาะแถวที่ยังใช้งานที่ v0.46.0, PROP-075 approved & applied 3 Aug 2026 UNIQUE (legal_form, registration_no) และ UNIQUE (tax_id) เมื่อ legal_form IS NOT NULL และสถานะยังใช้งาน — เพื่อให้โรงงานที่เปลี่ยนมือเป็นการโอนที่มีประวัติ · Site UNIQUE (mill_id) · DepartmentSite UNIQUE คู่ และ is_primary หนึ่งแถวต่อหน่วยงาน · SurfaceRoleGrant UNIQUE (membership_id, surface, department_id) |
| Mutabilityความเปลี่ยนแปลง | Department is mutable in its parent link and its legal block (dated re-parent, WF-80; classification and re-registration, WF-116) — department_id is immutable and renaming never changes identity, grants or history. v0.46.0, PROP-075 approved & applied 3 Aug 2026: re-parenting rewrites descendant department_path in the same transaction (DR-6) and moves no data; a TRANSFER moves the subtree, its mill_id binding and the sites whose presence rows belong only to that subtree, and moves no records at all (NFR-141). Site is mutable and FLAT — it has no parent link to change. DirectoryGrant is revoke-not-delete; DirectoryGroupMember rows may be time-bounded.Department เปลี่ยนได้ที่การเชื่อมแม่และบล็อกนิติฐานะ — department_id เปลี่ยนไม่ได้ การย้ายต้นสังกัดเขียน path ของลูกหลานใน transaction เดียวกัน และการโอนไม่ย้ายระเบียนเลย (NFR-141) ส่วน Site เรียงชั้นเดียว จึงไม่มีแม่ให้เปลี่ยน (WF-80 · WF-116 · v0.46.0) |
| Migrationการย้าย | One backfill (WF-80 step 1): every existing mill Tenant gets a department of its own — root and site in ONE node — and every existing SurfaceRoleGrant takes that department id. No ledger, quota, delivery or session data is touched; an ungrouped factory behaves exactly as before (FR-214).เติมข้อมูลครั้งเดียว (WF-80 ขั้น 1): Tenant โรงงานที่มีอยู่ทุกรายได้หน่วยงานของตน — เป็นทั้งรากและไซต์ในโหนดเดียว — และ SurfaceRoleGrant ที่มีอยู่ทุกแถวรับ department id นั้น ไม่แตะข้อมูลสมุดบัญชี โควตา การส่งมอบ หรือ session; โรงงานที่ไม่อยู่ในกลุ่มทำงานเหมือนเดิมทุกประการ (FR-214) |
| Profilesprofile | v0.46.0, PROP-075 approved & applied 3 Aug 2026: the profiles are HOMED HERE. Department, Site and DepartmentSite carry home: SPEC-ERD-FED in the graph’s dataModeling block and are stated in Section 7 of this document — they no longer live in SPEC-ERD-GRP, which cites them instead, because they now describe EVERY tenant and not only a factory group. The directory entities (DirectoryGroup · DirectoryGroupMember · DirectoryGrant) keep their delivered profiles (spec v0.28.3). Department, Site and DirectoryGroup are separate aggregate roots, so a directory change never locks the identity core and a site correction never locks a department.v0.46.0, PROP-075 approved & applied 3 Aug 2026 profile อยู่ที่นี่ Department Site และ DepartmentSite มี home: SPEC-ERD-FED ใน graph และระบุไว้ที่ข้อ 7 ของเอกสารนี้ ไม่อยู่ที่ SPEC-ERD-GRP อีกต่อไป |
Spec v0.26.0 homes the document_vault context here, beside identity, for one reason: a citizen id, a passport and a title deed in the same table as tenure would drag PDPA-sensitive identity into every land read. The vault is platform infrastructure — one typed, paged, audited store every capacity writes into and only its owner reads.
spec v0.26.0 ให้ context document_vault อยู่ที่นี่ข้าง ๆ เรื่องตัวตน ด้วยเหตุผลเดียว: การเก็บบัตรประชาชน หนังสือเดินทาง และโฉนดไว้ในตารางเดียวกับสถานะถือครอง จะลากข้อมูลตัวตนที่อ่อนไหวตาม PDPA เข้าไปในทุกการอ่านเรื่องที่ดิน คลังเอกสารเป็นโครงสร้างพื้นฐานของ platform — ที่เก็บเดียวที่ระบุชนิด เก็บเป็นหน้า และตรวจสอบได้ ซึ่งทุก capacity เขียนเข้าไปและมีเพียงเจ้าของที่อ่านได้
| EntityEntity | Attributesattribute | Rules that biteกฎที่มีผล |
|---|---|---|
| Document เอกสาร | document_id · document_type · name · owner_tenant_id · issued_on? · expires_on? · reference_no? · verification_state · uploaded_by · retention_classdocument_id · document_type · name · owner_tenant_id · issued_on? · expires_on? · reference_no? · verification_state · uploaded_by · retention_class | document_type covers บัตรประชาชน · ใบขับขี่ · visa · passport · เอกสารสิทธิ์ที่ดิน · บัตรชาวไร่ · บัตรสมาคมชาวไร่ · หนังสือสัญญา · อื่น ๆ. PDPA class personal (sensitive): encrypted at rest, stated retention, NO public object storage, operator access audited (NFR-75).ชนิดเอกสารครอบคลุมบัตรประชาชน · ใบขับขี่ · visa · passport · เอกสารสิทธิ์ที่ดิน · บัตรชาวไร่ · บัตรสมาคมชาวไร่ · หนังสือสัญญา · อื่น ๆ ชั้น PDPA เป็นข้อมูลส่วนบุคคล (อ่อนไหว): เข้ารหัสเมื่อจัดเก็บ ระบุระยะเก็บรักษา ห้ามใช้ object storage สาธารณะ และการเข้าถึงของ operator ถูกบันทึกตรวจสอบ (NFR-75) |
| DocumentPage หน้าเอกสาร | page_id · document_id · page_no · image_ref · captured_on · captured_by · ocr_text?page_id · document_id · page_no · image_ref · captured_on · captured_by · ocr_text? | Append-only. Pages, not files: a deed is photographed front and back, a lease has five pages and a signature page. Images live in object storage; reads resolve through short-lived signed URLs and are audited PER PAGE (A-2, NFR-75).append-only เก็บเป็นหน้า ไม่ใช่ไฟล์: โฉนดถ่ายทั้งด้านหน้าและด้านหลัง สัญญาเช่ามีห้าหน้าและหน้าลงนามหนึ่งหน้า ไฟล์ภาพอยู่ใน object storage การอ่านผ่าน signed URL อายุสั้นและบันทึกตรวจสอบรายหน้า (A-2, NFR-75) |
Consumers: land_rights (a LandRight has exactly one Document; a Lease attaches its contract pages), soil analysis (the lab report) and onboarding evidence. Deed identifiers and landlord identity never cross the PROP-048 network wall (NFR-78) — the vault is a read for its owner and for whoever the owner has explicitly let in.
ผู้ใช้งาน: land_rights (LandRight มี Document หนึ่งฉบับพอดี ส่วน Lease แนบหน้าสัญญาของตน) การวิเคราะห์ดิน (รายงานห้องปฏิบัติการ) และหลักฐานตอนขึ้นทะเบียน เลขทะเบียนโฉนดและตัวตนเจ้าของที่ดินไม่ข้ามกำแพงความลับของเครือข่ายตาม PROP-048 (NFR-78) — คลังเอกสารเป็นการอ่านของเจ้าของ และของผู้ที่เจ้าของอนุญาตอย่างชัดแจ้งเท่านั้น
Spec v0.41.0 (PROP-040, approved & applied 30 Jul 2026) adds nine entities homed here — eight in federation plus OfflineGrantSet, which lives in on_site_gateway and is profiled here beside the model it compiles. Every profile lands in the same change set as the entity (authority rule 6). Logical model and normative rules: graph federation.permissionModel · SPEC-PRD-FED Section 13.
spec v0.41.0 (PROP-040 อนุมัติและ apply 30 ก.ค. 2569) เพิ่ม entity เก้ารายการที่มีบ้านอยู่ที่นี่ — แปดรายการใน federation และ OfflineGrantSet ที่อยู่ในบริบท on_site_gateway แต่ทำ profile ไว้ที่นี่ข้าง model ที่มันคอมไพล์ ทุก profile มาในชุดการเปลี่ยนเดียวกับ entity (authority rule 6) model เชิงตรรกะและกติกาบรรทัดฐาน: federation.permissionModel ใน graph · SPEC-PRD-FED ข้อ 13
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| action_key | text | — | uuid_v7() | PK |
| category_code | text | — | — | FK → ActionCategory |
| object | text | — | — | — |
| act | text | — | — | — |
| facets_available | text[] | — | — | — |
| default_effect | jsonb | — | — | — |
| capacities | text[] | — | — | — |
| surfaces | text[] | — | — | — |
| sensitivity | text | — | — | — |
| amount_bearing | boolean | — | — | — |
| delegable | boolean | — | — | — |
| department_delegable | boolean | — | — | — |
| four_eyes_required | boolean | — | — | — |
| no_self_approval | boolean | — | — | — |
| offline_allowed | boolean | — | — | — |
| escalatable | boolean | — | — | — |
| response_window_minutes | integer | ✓ | — | — |
| blocking | boolean | — | — | — |
| external_approval | text | ✓ | — | — |
| catalog_version | text | — | — | — |
| published_at | timestamptz | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| category_code | text | — | uuid_v7() | PK |
| name_en | text | — | — | — |
| name_th | text | — | — | — |
| capacities | text[] | — | — | — |
| review_owner | text | — | — | — |
| sort_order | smallint | — | — | — |
| note | text | ✓ | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| group_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → Tenant |
| department_id | uuid | — | — | FK → department |
| code | text | — | — | — |
| name_th | text | — | — | — |
| name_en | text | — | — | — |
| parent_group_id | uuid | ✓ | — | FK → PermissionGroup |
| template_id | text | ✓ | — | — |
| is_position | boolean | — | — | — |
| status | text | — | — | — |
| created_by | text | — | — | FK → Membership |
| created_at | timestamptz | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| grant_id | uuid | — | uuid_v7() | PK |
| group_id | uuid | — | — | FK → PermissionGroup |
| action_key | text | — | — | FK → ActionCatalog |
| facets | text[] | — | — | — |
| effect | text | — | — | — |
| read_grade | text | ✓ | — | — |
| scope_department_path | ltree | — | — | — |
| scope_surface | text | ✓ | — | — |
| scope_place_id | uuid | ✓ | — | — |
| scope_position_id | uuid | ✓ | — | — |
| scope_object_filter | jsonb | ✓ | — | — |
| scope_mode | text | ✓ | — | — |
| amount_ceiling | numeric(12,2) | ✓ | — | — |
| four_eyes | boolean | — | — | — |
| no_self_approval | boolean | — | — | — |
| offline_allowed | boolean | — | — | — |
| set_by | text | — | — | FK → Membership |
| set_at | timestamptz | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| appointment_id | uuid | — | uuid_v7() | PK |
| membership_id | uuid | — | — | FK → Membership |
| group_id | uuid | — | — | FK → PermissionGroup |
| department_id | uuid | — | — | FK → department |
| place_id | text | ✓ | — | — |
| valid_from | date | — | — | — |
| valid_to | date | ✓ | — | — |
| appointed_by | text | — | — | FK → Membership |
| appointed_at | timestamptz | — | — | — |
| status | text | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| override_id | uuid | — | uuid_v7() | PK |
| membership_id | uuid | — | — | FK → Membership |
| action_key | text | — | — | FK → ActionCatalog |
| facets | text[] | — | — | — |
| effect | text | — | — | — |
| read_grade | text | ✓ | — | — |
| scope_department_path | ltree | — | — | — |
| scope_surface | text | ✓ | — | — |
| scope_place_id | uuid | ✓ | — | — |
| scope_object_filter | jsonb | ✓ | — | — |
| reason | text | — | — | — |
| granted_by | text | — | — | FK → Membership |
| approved_by | text | ✓ | — | FK → Membership |
| granted_at | timestamptz | — | — | — |
| expires_at | timestamptz | — | — | — |
| status | text | — | — | — |
v0.45.0 (PROP-074) — renamed from CapacityCompatibility and made first-class (OQ-13, client direction in one word: composition). The authored object is now the RULE, carrying its basis ONCE; the pairwise matrix (capacity_a · capacity_b · rule) becomes a compiled read model derived from three rules — neutrality_alone_only · buyer_not_seller · disclosed_dual_role — rather than roughly fifty-four authored cells each restating the same basis. Enforcement is unchanged: at grant, never in the permission layer (P-9). A rule whose holder is a person is refused — there is no composition on the person side.
v0.45.0 (PROP-074) — เปลี่ยนชื่อจาก CapacityCompatibility และทำให้เป็นวัตถุชั้นหนึ่ง วัตถุที่เขียนคือกฎ ซึ่งถือเหตุผลไว้ครั้งเดียว ส่วนตารางคู่กลายเป็น read model ที่คอมไพล์จากกฎสามข้อ การบังคับใช้ไม่เปลี่ยน: ตอนมอบ ไม่ใช่ในชั้นสิทธิ์ (P-9)
| Columnคอลัมน์ | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refคีย์ / อ้างอิง |
|---|---|---|---|---|
| rule_id | uuid | — | uuid_v7() | PK |
| rule_code | text | — | — | — |
| name_en | text | — | — | — |
| name_th | text | — | — | — |
| effect | text (enum) | — | — | allowed | allowed_with_disclosure | forbidden |
| applies_to | text[] | — | — | — |
| basis_en | text | — | — | — |
| basis_th | text | — | — | — |
| rule_version | text | — | — | — |
| effective_from | date | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| escalation_id | uuid | — | uuid_v7() | PK |
| requester_membership_id | uuid | — | — | FK → Membership |
| action_key | text | — | — | FK → ActionCatalog |
| facet | text | — | — | — |
| target_object_type | text | — | — | — |
| target_object_id | text | — | — | — |
| captured_values | jsonb | ✓ | — | — |
| reason | text | ✓ | — | — |
| evidence_ref | text | ✓ | — | — |
| routing_group_ids | uuid[] | — | — | — |
| scope_department_path | ltree | — | — | — |
| status | text | — | — | — |
| response_window_minutes | integer | — | — | — |
| blocking | boolean | — | — | — |
| decided_by | text | ✓ | — | FK → Membership |
| decided_at | timestamptz | ✓ | — | — |
| resulting_write_ref | text | ✓ | — | — |
| created_at | timestamptz | — | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| offline_set_id | uuid | — | uuid_v7() | PK |
| gateway_node_id | uuid | — | — | FK → GatewayNode |
| station_client_id | uuid | ✓ | — | FK → StationClient |
| compiled_at | timestamptz | — | — | — |
| lease_expires_at | timestamptz | — | — | — |
| appointments | jsonb | — | — | — |
| grant_digest | text | — | — | — |
| signature | text | — | — | — |
| synced_at | timestamptz | ✓ | — | — |
| status | text | — | — | — |
Consistency boundaries (graph dataModeling.aggregates). Six roots keep the model deliberately apart: ActionCatalog (catalog + categories, versioned and published whole, read-only to tenants) · PermissionGroup (position + grants + appointments — a grant never exists without its position, and the validators run inside this boundary) · AccountActionOverride (an override commits with its reason, expiry and second approver or not at all) · CompositionRule (a platform reference version, effective-forward, evaluated at capacity grant and never in the permission layer) · EscalationRequest (routing set frozen at creation; the resulting write carries both identities) · OfflineGrantSet (append-only signed sets under dated leases; an expired lease resolves to nothing). Full transaction rules are in SPEC-DDD-FED Section 11.
ขอบเขตความสอดคล้อง (dataModeling.aggregates ใน graph) หกรากแยก model ออกจากกันอย่างตั้งใจ: ActionCatalog (แคตาล็อกและหมวด ประกาศทั้งชุดเป็นเวอร์ชัน tenant อ่านเท่านั้น) · PermissionGroup (ตำแหน่ง grant และการแต่งตั้ง — grant ไม่มีอยู่โดยไม่มีตำแหน่ง และ validator ทำงานในขอบเขตนี้) · AccountActionOverride (การลบล้างผูกพร้อมเหตุผล วันหมดอายุ และผู้อนุมัติที่สอง หรือไม่เกิดขึ้นเลย) · CompositionRule (เวอร์ชันอ้างอิงของแพลตฟอร์ม มีผลไปข้างหน้า ประเมินตอนมอบ capacity ไม่ประเมินในชั้นสิทธิ์) · EscalationRequest (ชุดผู้รับตรึงตอนสร้าง; การเขียนที่เกิดขึ้นถือสองตัวตน) · OfflineGrantSet (ชุด append-only ที่ลงลายมือชื่อ ภายใต้ lease ที่มีวันที่; lease ที่หมดอายุตัดสินเป็นไม่มีสิทธิ์) กติกา transaction เต็มอยู่ใน SPEC-DDD-FED ข้อ 11
Applied 2026-08-06 as spec v0.53.0. An unfinished sitting is a RECORD, not client state: a grower who comes back a week later — or on another handset — is the ordinary case. OnboardingSession holds session_id · person_id? · route · current_step · steps_completed · steps_skipped · invitation_id? · started_at · last_seen_at · completed_at? · status. person_id is null until an enrolment credential exists — before that there is a sitting and no account (FR-426). Nothing in it is a credential and nothing in it authorises anything.
apply 2026-08-06 เป็น spec v0.53.0 นัดที่ยังไม่จบเป็นระเบียน ไม่ใช่สถานะฝั่งเครื่อง OnboardingSession เก็บ session_id · person_id? · route · current_step · steps_completed · steps_skipped · invitation_id? · started_at · last_seen_at · completed_at? · status · person_id ว่างจนกว่าจะมีปัจจัยลงทะเบียน ไม่มีอะไรในนั้นเป็นปัจจัยยืนยัน และไม่มีอะไรในนั้นอนุญาตอะไร
Persistence profile. Table onboarding_session, PK session_id, FKs to Person and NetworkInvitation, indexes on person_id where present and on (status, last_seen_at); mutability mutable; PDPA personal; its own aggregate root. Retention: ninety days from last_seen_at for an abandoned sitting, then deleted — an unfinished sitting is a convenience, never evidence; a completed sitting is reduced on the day it completes to completed_at plus the route.
Profile ทางกายภาพ ตาราง onboarding_session · PK session_id · FK ไป Person และ NetworkInvitation · ดัชนีบน person_id และ (status, last_seen_at) · mutability mutable · PDPA personal · aggregate root ของตัวเอง การเก็บรักษา: 90 วันนับจาก last_seen_at สำหรับนัดที่ถูกทิ้ง แล้วลบ · นัดที่จบแล้วถูกลดเหลือ completed_at กับเส้นทางในวันที่จบ
| Our levelระดับของเรา | ETDA IALIAL ของ ETDA | Noteหมายเหตุ |
|---|---|---|
| — | — | An account, nothing verified. No national claim is made.มีบัญชี ยังไม่มีอะไรถูกยืนยัน ไม่อ้างอะไรตามมาตรวัดชาติ |
| phone | — | Deliberately unmapped: a verified number is not an identity-proofing event on any national scale (A-76).ตั้งใจไม่เทียบ: เบอร์ที่ยืนยันแล้วไม่ใช่การพิสูจน์ตัวตนบนมาตรวัดใด |
| national_id | IAL 1.3 | Retained as a REQUIREMENT level, never as a result — a passing ekyc satisfies it (FR-421).คงไว้เป็นระดับข้อกำหนด ไม่ใช่ผล — ekyc ที่ผ่านทำให้ผ่าน (FR-421) |
| ekyc | IAL 2.3 | Card plus a live check with certified PAD and a DOPA registry cross-check (FR-431).บัตรบวกการตรวจใบหน้าสดที่ผ่านการรับรอง และตรวจกับทะเบียนราษฎร์ DOPA |
A mapping row is a claim: it is stated at the level our check actually reaches, re-read whenever the vendor check or the ETDA edition changes, and an absent row is better than an optimistic one. We map; we do not rename (OQ-4).
แถวเทียบคือคำกล่าวอ้าง ระบุไว้ที่ระดับที่การตรวจของเราไปถึงจริง อ่านใหม่เมื่อผู้ให้บริการหรือฉบับของ ETDA เปลี่ยน และการไม่มีแถวดีกว่าแถวที่มองโลกในแง่ดีเกินไป เราเทียบ ไม่เปลี่ยนชื่อ (OQ-4)
Applied 18 Aug 2026 as spec v0.75.0 (A-111, nine rules; register legalLayer; check V-20). It is the successor PROP-083 OQ-3 deferred to PROP-084, and it REPLACES that sketch: the platform-owned legal-person register is not built, because what the applied model lacked was a time axis, not a shared registry. A tenant may hold many juristic persons — which the applied Department legal block already permitted — and the legal identity of each is now a dated profile the department owns. The layer is optional, it is never monetary, and nothing in it stands between a person and a signed-in session. The billing half of the proposal left it at Rev 0.9 by the OQ-7 decision and is PROP-099’s subject.
apply 18 ส.ค. 2569 เป็น spec v0.75.0 (A-111 เก้ากฎ ทะเบียน legalLayer การตรวจ V-20) เป็นงานสืบเนื่องที่ PROP-083 OQ-3 ส่งต่อมา และแทนภาพร่างนั้น: ไม่สร้างทะเบียนนิติบุคคลกลางของแพลตฟอร์ม เพราะสิ่งที่แบบจำลองขาดคือแกนเวลา ไม่ใช่ทะเบียนกลาง tenant หนึ่งถือนิติบุคคลได้หลายราย และตัวตนทางกฎหมายของแต่ละรายเป็น profile ที่มีวันที่ซึ่งหน่วยงานเป็นเจ้าของ ชั้นนี้เป็นทางเลือก ไม่เกี่ยวกับเงิน และไม่มีข้อใดขวางระหว่างคนกับการเข้าใช้งาน ครึ่งการเรียกเก็บอยู่ที่ PROP-099
| Ruleกฎ | What it bindsผูกพันอะไร |
|---|---|
| R-ONENODE | The department is the legal node; there is no second layer. A tenant’s legal identity is a dated profile OWNED BY a Department, never a separate party it references. No entity but Department carries a hierarchy parent, a hierarchy path or a grant scope, or is named as the responsible body of a site, a mill or a quota. The records below are SUPPORTING RECORDS of that aggregate; a party-like entity beside the tree, under any name, is an amendment argued in a change set.หน่วยงานคือโหนดทางกฎหมาย และไม่มีชั้นที่สอง |
| R-LEGALOPT | The layer is OPTIONAL and NEVER MONETARY. A tenant may hold zero profiles forever and no flow, validation, gate, banner or completeness score reads that as incomplete; no requirement whose subject is money, quota, price, weight, queue position, credit or a ledger posting may read these records. It does not touch the applied legal_registration qualification (FR-493).ชั้นนี้เป็นทางเลือกและไม่เกี่ยวกับเงิน |
| R-LEGALDATED | A profile opens on a date and ends on a date, and the present is DERIVED. Append-only, never overlapping another live profile of the same department, superseded rather than edited. One department, one live profile; one registered body may operate many departments; two bodies at once are two departments. This is the record PROP-075 OQ-7’s transfer with a history has been owed since v0.46.0.profile เปิดตามวันที่และจบตามวันที่ ปัจจุบันคำนวณออกมา |
| R-ROLEINCONTEXT | entity_role is a statement about a body IN A DEPARTMENT AT A TIME, so it lives on the dated profile — the same company is holding at the root and operating in a subsidiary unit, and the role changes without the identity changing.บทบาทขึ้นกับบริบท จึงอยู่บน profile ที่มีวันที่ |
| R-TWONUMBERS | The registrar’s number and the taxpayer’s number are two namespaces and neither is derived from the other. Both nullable, both stored as text exactly as the counterparty’s document prints them (A-105 R-THEIRNUMBER); a coincidence is an explicit copy with its provenance recorded; no digit parsed, no check digit computed.เลขนายทะเบียนกับเลขผู้เสียภาษีเป็นสองปริภูมิชื่อ ไม่คำนวณจากกัน |
| R-VATDATED | VAT standing is a dated operator registration with dated places. A change of VAT standing writes a VAT row and NEVER a new legal-profile version, and standing is never inferred from a revenue figure the platform can see.สถานะ VAT เป็นการจดที่มีวันที่ พร้อมสถานที่ที่มีวันที่ |
| R-EXTERNALONLY | A platform-owned row for an off-platform body is a REFERENCE, and exists only where there is no tenant and no department — minted on demand, public-registry identity only, never browsable, never a scope, never a parent, LINKED and SUPERSEDED the day the body receives a department. It NARROWS the second half of A-103 R-LEGALREF. Published in SPEC-ERD-GRP Section 9.แถวของแพลตฟอร์มสำหรับนิติบุคคลนอกแพลตฟอร์มเป็นการอ้างอิง |
| R-STATEHONEST | Verification is a state with an owner, and a copy never claims more than the state it copied. Only an operator writes operator_verified, and only against evidence recorded under FR-492; expired is reached only by the passage of verification_expires_on. Nothing downstream — a billing reference, a snapshot, an export, an extract, a report, an API response, a printed document — presents an unverified value as verified.การตรวจเป็นสถานะที่มีเจ้าของ และสำเนาไม่อ้างเกินสถานะที่คัดมา |
| R-ONECLAIM | One live registration across tenants, proved by a blind operator-side index that holds no legal facts and discloses nothing. It ENFORCES and never discloses, blocks activation on a collision, and opens or moves a claim in ONE serialized transaction. Published in SPEC-ERD-PLT Section 5.หนึ่งทะเบียนที่ใช้งาน พิสูจน์ด้วยดัชนีที่มองไม่เห็นเนื้อข้อมูล |
The five legal attributes and the two partial uniques are RETIRED from Department, which keeps department_id · tenant_id · parent_department_id? · department_path · status and carries no legal mirror column. The crosswalk is declared once, at legalLayer.crosswalk, in the FR-396 style.
attribute ทางกฎหมายห้าตัวและคีย์ไม่ซ้ำสองชุดถูกยกเลิกจาก Department ซึ่งคงไว้ department_id · tenant_id · parent_department_id? · department_path · status และไม่มีคอลัมน์สำเนาสถานะกฎหมาย ตารางแปลงประกาศครั้งเดียวที่ legalLayer.crosswalk
| Retired from Departmentยกเลิกจาก Department | Nowย้ายไป | Readingการอ่าน |
|---|---|---|
| legal_form | DepartmentLegalProfile.legal_form | required on a profile; a department with no profile is an internal unit — the common case |
| legal_name | DepartmentLegalProfile.legal_name | plus legal_name_en?, which the applied attribute had nowhere to put |
| registration_no? | DepartmentLegalProfile.registration_no? | with registration_no_source? — a number with no provenance is a defect (NFR-194) |
| tax_id? | DepartmentLegalProfile.tax_id? | with tax_id_source?; not unique at any grain (EXH-084-A) |
| entity_role? | DepartmentLegalProfile.entity_role | contextual, so it versions with the profile (R-ROLEINCONTEXT) |
| unique (legal_form, registration_no) | one live profile per department + RegistrationUniquenessIndex | the cross-tenant half cannot be a unique on a tenant-scoped table (R-ONECLAIM) |
| unique tax_id | RETIRED, re-declared at no grain | every establishment of one operator shares that operator’s taxpayer number |
| Stateสถานะ | Written byผู้เขียน | Meansความหมาย |
|---|---|---|
| self_declared แจ้งเอง | tenant | what a tenant’s own write produces — a fully usable row, and the default |
| evidence_submitted ส่งหลักฐานแล้ว | tenant | evidence is recorded under FR-492 and awaits an operator reading |
| operator_verified ผู้ดำเนินการตรวจแล้ว | operator | an operator read the evidence and recorded verified_by and verified_on |
| expired หมดอายุ | the date | verification_expires_on has passed — reached by that date and by nothing else |
A tenant’s own act never leaves self_declared by itself, and no copy claims more than the state it copied — not a billing reference, a bill-to snapshot, an export, an extract, a report, an API response or a printed document (NFR-197, the constraint PROP-099 inherits). This state is never the applied legal_registration qualification: two objects, two validities, neither read from the other (FR-493).
การกระทำของ tenant เองไม่พาแถวออกจาก self_declared และสำเนาไม่อ้างเกินสถานะที่คัดมา ไม่ว่าในการอ้างการเรียกเก็บ snapshot การส่งออก การดึงข้อมูล รายงาน คำตอบ API หรือเอกสารที่พิมพ์ (NFR-197) สถานะนี้ไม่ใช่คุณสมบัติ legal_registration ที่ apply แล้ว สองวัตถุ สองความสมบูรณ์ ไม่อ่านจากกัน (FR-493)
Rendered from the graph’s dataModeling block; every profile lands in the same change set as the entity (authority rule 6). All three are append_only and tenant-scoped, and every foreign key resolves inside the row’s own tenant (NFR-195).
render จาก block dataModeling ใน graph ทุก profile มาในชุดแก้ไขเดียวกับ entity (authority rule 6) ทั้งสามเป็น append_only ขอบเขตระดับ tenant และทุก foreign key แก้ค่าได้ภายใน tenant ของแถวเอง (NFR-195)
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| legal_profile_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| department_id | uuid | — | — | FK → department — the one owner key |
| legal_form | text (legalForms row id) | — | — | — |
| legal_name | text | — | — | — |
| legal_name_en | text | ✓ | — | — |
| registration_no | text (as issued — leading zeros significant) | ✓ | — | UNIQUE (live, across tenants — via the index) |
| registration_no_source | text (enum: registrar_document | rd_document | copied_from_registration_no | not_applicable) | ✓ | — | — |
| tax_id | text (as printed) | ✓ | — | never unique, at any grain |
| tax_id_source | text (enum: registrar_document | rd_document | copied_from_registration_no | not_applicable) | ✓ | — | — |
| registered_on | date | ✓ | — | — |
| registry_status | text (enum) | ✓ | — | — |
| entity_role | text (enum: operating | holding | parent) | — | — | — |
| effective_from | date | — | — | — |
| resigned_on | date | ✓ | — | — |
| reason | text | ✓ | — | — |
| is_current | boolean | — | true | UNIQUE (department_id — partial) |
| supersedes_profile_id | uuid | ✓ | — | FK → department_legal_profile |
| evidence_ref | text (document ref) | ✓ | — | → document_vault |
| verification_state | text (enum: self_declared | evidence_submitted | operator_verified | expired) | — | self_declared | — |
| verified_by | uuid | ✓ | — | FK → person — operator only |
| verified_on | timestamptz | ✓ | — | — |
| verification_expires_on | date | ✓ | — | the only path to expired |
| status | text (enum: live | superseded | void) | — | live | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| vat_registration_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| department_id | uuid | — | — | FK → department — the registered operator |
| legal_profile_ref | uuid | ✓ | — | FK → department_legal_profile — recorded, not a version driver |
| tax_id_at_registration | text (as printed) | ✓ | — | — |
| effective_from | date | — | — | the date the certificate states |
| ceased_on | date | ✓ | — | — |
| reason | text | ✓ | — | — |
| is_current | boolean | — | true | UNIQUE (department_id — partial) |
| evidence_ref | text (document ref) | ✓ | — | → document_vault |
| verification_state | text (enum: self_declared | evidence_submitted | operator_verified | expired) | — | self_declared | — |
| verified_by | uuid | ✓ | — | FK → person — operator only |
| verified_on | timestamptz | ✓ | — | — |
| verification_expires_on | date | ✓ | — | — |
| status | text (enum: live | superseded | void) | — | live | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| vat_establishment_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| vat_registration_id | uuid | — | — | FK → vat_registration |
| department_site_id | uuid | — | — | FK → department_site |
| branch_code | text (as printed — five digits, 00000 = head office) | — | — | UNIQUE (vat_registration_id,branch_code — partial) |
| is_head_office | boolean | — | false | — |
| effective_from | date | — | — | — |
| ceased_on | date | ✓ | — | — |
| is_current | boolean | — | true | — |
| evidence_ref | text (document ref) | ✓ | — | the place’s own ภ.พ.20 |
| verification_state | text (enum: self_declared | evidence_submitted | operator_verified | expired) | — | self_declared | per place — never inherited |
| verified_by | uuid | ✓ | — | FK → person — operator only |
| verified_on | timestamptz | ✓ | — | — |
| verification_expires_on | date | ✓ | — | — |
| status | text (enum: live | superseded | void) | — | live | — |
DepartmentLegalProfile joins the Department aggregate as a supporting record: opening, superseding or ending a profile commits with the department it belongs to, which is what makes “one live profile per department, intervals never overlapping” enforceable. VATRegistration is its own root with VATEstablishment inside it — ceasing a registration closes its places in the same transaction, and a verified registration never verifies them by inheritance. The cross-tenant transfer of a live registration commits the closed claim, the new claim and both profile rows in the single serialized transaction of FR-495.
DepartmentLegalProfile เข้าอยู่ใน aggregate Department เป็นระเบียนสนับสนุน การเปิด แทน หรือจบ commit พร้อมหน่วยงานเจ้าของ VATRegistration เป็นรากของตัวเองโดยมี VATEstablishment อยู่ภายใน และการโอนข้าม tenant commit ทุกอย่างในธุรกรรมเดียวตาม FR-495
| Targetเป้าหมาย | Kindชนิด | What changesเปลี่ยนอะไร |
|---|---|---|
| A-103 R-LEGALREF | narrowed | the second half applies to an OFF-PLATFORM body only; the first half is unchanged and is now the general case (R-EXTERNALONLY) |
| legalReference dispositions | corrected | all four declared cross-tenant references keep Department as their target and the re-point promise is cancelled; two ownership references and the group apex gain ExternalLegalEntityReference only where the body holds no tenant, and Quota.holder_department_id does not even gain that — a holder’s own unit has a tenant by construction |
| Department attributes | retired | the five legal attributes move to the dated profile with the crosswalk of 15.2; no legal mirror column remains |
| Department partial uniques | retired | (legal_form, registration_no) is re-declared at the live-profile grain plus the index; tax_id is re-declared at no grain at all |
FR-481…FR-488 and FR-491…FR-496; NFR-192…NFR-195 and NFR-197…NFR-199. Two functional ids and one quality id from the same run are HELD for the billing half and are deliberately absent here — they are numbered in PROP-099, which is where the billing profile now lives. Check V-20 — nine legs, all live at application, read out of legalLayer, the entity register and dataModeling. It reports and never repairs, and it exists against the three defect classes this layer can acquire: an optional field that quietly becomes a gate, a dated profile that quietly becomes a party, and a blind index that quietly becomes a registry.
FR-481…FR-488 และ FR-491…FR-496 · NFR-192…NFR-195 และ NFR-197…NFR-199 ส่วนรหัสอีกสามรหัสในชุดเดียวกันจองไว้ให้ครึ่งการเรียกเก็บใน PROP-099 การตรวจ V-20 เก้าขา ทำงานทั้งหมดตั้งแต่วัน apply รายงานและไม่ซ่อมแซม
| Legขา | What it readsอ่านอะไร |
|---|---|
| (a) | no books.postingMap row, no delivery, settlement, quota or queue requirement and no state-machine guard names any of the four legal and VAT entities in entities.read or entities.write |
| (b) | every tenant-facing attribute of those four is nullable or system-set; all three tenant-side records declare verification_state with only its four declared values and a default of self_declared; no tenant-side path reaches operator_verified; and no path reaches expired except the passage of verification_expires_on |
| (c) | no second hierarchy — no entity but Department declares a hierarchy parent or a path, DepartmentLegalProfile declares exactly one owner foreign key, no grant scope names any of the five, and Department carries no current-legal mirror attribute |
| (d) | identifier grain — no uniqueness on tax_id at any grain, no registration uniqueness at the historical-version or establishment grain, and the live uniqueness is declared with its exact predicate and enforced by the index |
| (e) | the external reference is bounded — it declares no tenant_id, no hierarchy parent, no path, no entity_role, no grant scope and no money attribute, and is named only by OwnershipEdge or FactoryGroup.apex_entity_id |
| (f) | the wall — every foreign key on the three tenant-side entities resolves inside the row’s own tenant, and the declared cross-tenant reference class still has exactly its four members |
| (g) | no new authority — no permission key, claim, grant scope or scope kind names any of the five, and every declared write path is authorized by the compiled department-scoped permission set |
| (h) | verification is honest — no declared rendering, export, extract, report or template presents a value from an unverified row as verified |
| (i) | the index is blind and bounded — only its closed column list, no raw number, no name, no tax id, no tenant of its own, and exactly one live claim per (namespace, form, fingerprint) |
| Revฉบับ | Dateวันที่ | Changesการเปลี่ยนแปลง |
|---|---|---|
| 1.0 | 2026-07-08 | Initial version — PROP-005 (FED, spec v6.0): federation perspective of the identity data model — 8 owned identity entities, domain-profile attachment via tenant_id, relationships & cardinalities, the tenant→party / user→person migration map, and framework mapping onto ASP.NET Core Identity.ฉบับแรก — PROP-005 (FED, spec v6.0): มุมมอง federation ต่อ model ข้อมูลอัตลักษณ์ — entity อัตลักษณ์ที่เป็นเจ้าของ 8 รายการ การผูกโปรไฟล์ capacityผ่าน tenant_id ความสัมพันธ์และคาร์ดินาลิตี้ แผนที่ย้าย tenant→party / user→person และการแมปกับ ASP.NET Core Identity |
| 0.1.0 | 2026-07-11 | PROP-014 (spec v0.1.0): semantic versioning restarted at 0.1.0 (was Rev 1.0 · 2026-07-08); docnav updated for the gov_cluster split — GOV re-homed to docs/gov/ocsb/, new BOARD (กอน.) sibling added.PROP-014 (spec v0.1.0): รีสตาร์ท semantic versioning ที่ 0.1.0 (เดิม Rev 1.0 · 2026-07-08); ปรับ docnav ตามการแยก gov_cluster — ย้าย GOV ไป docs/gov/ocsb/ เพิ่มพี่น้อง BOARD (กอน.) |
| 0.2.0 | 2026-07-13 | PROP-018 (spec v0.4.0): comprehensive perspective data modeling — scoped entity-relationship diagrams (Fig. 1–2), column-level persistence profiles for the 9 home entities (Section 7), keys / indexes / mutability & PDPA classes (Section 8) and aggregate consistency boundaries (Section 9) — all rendered from the graph's new dataModeling block.PROP-018 (spec v0.4.0): การ model ข้อมูลรายมุมมองฉบับครบ — แผนภาพความสัมพันธ์ entity เฉพาะมุมมอง (ภาพที่ 1–2), persistence profile ระดับ column ของ entity ที่ home อยู่ฉบับนี้ 9 รายการ (ข้อ 7), key / index / ชั้น mutability และ PDPA (ข้อ 8) และขอบเขตความสอดคล้องของ aggregate (ข้อ 9) ทั้งหมด render จาก block ใหม่ dataModeling ใน graph |
| 0.3.0 | 2026-07-23 | PROP-047 (spec v0.19.0): Tenant.base_province re-typed text → smallint carrying the Province enum code (TIS 1099-2548); registry in the shared kernel, CHECK generated from the enum — no reference table / FK / seed. RolePermission.scope_ref for scope_type = province carries the numeric code as text (OQ-3).PROP-047 (spec v0.19.0): Tenant.base_province เปลี่ยนชนิดจาก text → smallint เก็บรหัส enum Province (มอก. 1099-2548); ทะเบียนอยู่ใน shared kernel, CHECK generate จาก enum — ไม่มีตารางอ้างอิง / FK / seed ส่วน RolePermission.scope_ref เมื่อ scope_type = province เก็บรหัสตัวเลขเป็น text (OQ-3) |
| 0.4.0 | 2026-07-25 | PROP-026 accepted & applied (spec v0.25.0, D-3/D-4): the identity core gains the four directory entities (Department · DirectoryGroup · DirectoryGroupMember · DirectoryGrant) and three added columns (SurfaceRoleGrant.department_id with the new uniqueness, RolePermission.scope_type +department_path, PermissionCatalog.department_delegable); four new relationship edges; new Section 11 on directory persistence, mutability and the one-time migration backfill.PROP-026 รับและ apply (spec v0.25.0, D-3/D-4): แกนอัตลักษณ์เพิ่ม entity ไดเรกทอรีสี่รายการ (Department · DirectoryGroup · DirectoryGroupMember · DirectoryGrant) และคอลัมน์ใหม่สามรายการ (SurfaceRoleGrant.department_id พร้อมความไม่ซ้ำใหม่, RolePermission.scope_type +department_path, PermissionCatalog.department_delegable); เส้นความสัมพันธ์ใหม่สี่กลุ่ม; เพิ่มข้อ 11 เรื่องการจัดเก็บ ความเปลี่ยนแปลง และการเติมข้อมูลย้ายครั้งเดียวของไดเรกทอรี |
| 0.5.0 | 2026-07-25 | PROP-048 (spec v0.26.0): new Section 12 — the document_vault context (Document · DocumentPage) is homed beside identity so PDPA-sensitive documents never sit inside the land model; encrypted at rest, short-lived signed reads, per-page audit, stated retention, no public object storage (NFR-75).PROP-048 (spec v0.26.0): เพิ่มข้อ 12 — context document_vault (Document · DocumentPage) อยู่ข้างเรื่องตัวตน เพื่อไม่ให้เอกสารที่อ่อนไหวตาม PDPA ไปอยู่ใน model ที่ดิน เข้ารหัสเมื่อจัดเก็บ อ่านผ่าน signed URL อายุสั้น บันทึกตรวจสอบรายหน้า ระบุระยะเก็บรักษา และห้าม object storage สาธารณะ (NFR-75) |
| 0.5.1 | 2026-07-28 | Physical-model batch 3 (spec v0.28.3): two corrections to the applied SurfaceRoleGrant profile that batch 3 exposed — role_id is re-typed uuid → text (role key) (roles are graph catalogue nodes, never a table), and department_id becomes a real FK now that Department is profiled. Section 11’s standing back-audit note is retired — the four directory entities (Department · DirectoryGroup · DirectoryGroupMember · DirectoryGrant) now carry delivered profiles in their home doc SPEC-ERD-GRP Sections 6–8. No change to the identity core.แบบจำลองเชิงกายภาพก้อนที่ 3 (spec v0.28.3): ยกเลิกหมายเหตุ back-audit ในข้อ 11 — entity ไดเรกทอรีสี่รายการมี profile ที่ส่งมอบแล้วในเอกสารบ้าน SPEC-ERD-GRP ข้อ 6–8 ไม่มีการเปลี่ยนแกนอัตลักษณ์ |
| 0.6.0 | 2026-07-30 | PROP-040 approved & applied (spec v0.41.0): new Section 13 — nine entities with full persistence profiles in the same change set (authority rule 6): ActionCatalog · ActionCategory · PermissionGroup · PermissionGroupGrant · PositionAppointment · AccountActionOverride · CompositionRule · EscalationRequest · OfflineGrantSet, plus six declared consistency boundaries. Department paths are typed ltree as PROP-026 established; PermissionCatalog and SurfaceRoleGrant are expanded in their notes rather than changed — no applied column moved. Sections 13/14 renumbered to 14/15.PROP-040 อนุมัติและ apply (spec v0.41.0): เพิ่มข้อ 13 — entity เก้ารายการพร้อม persistence profile ครบในชุดการเปลี่ยนเดียวกัน (authority rule 6): ActionCatalog · ActionCategory · PermissionGroup · PermissionGroupGrant · PositionAppointment · AccountActionOverride · CompositionRule · EscalationRequest · OfflineGrantSet และหกขอบเขตความสอดคล้อง department path เป็นชนิด ltree ตามที่ PROP-026 วางไว้; PermissionCatalog และ SurfaceRoleGrant ขยายในหมายเหตุ ไม่ได้เปลี่ยนโครงสร้าง — ไม่มี column ที่ apply แล้วถูกย้าย เลขข้อ 13/14 เปลี่ยนเป็น 14/15 |
| 0.7.0 | 2026-07-31 | PROP-067 approved & applied — spec v0.42.0. Six entities enter the identity core: PhoneNumber (UNIQUE e164 among ACTIVE rows — where NFR-14’s constraint now lives; one primary; removal holds a cooling period) · ExternalIdentity (UNIQUE (provider, provider_subject); email stored for display, never indexed) · Passkey (credential_id UNIQUE; sync flags recorded, never used to refuse) · IdentityCheck (card + live check; writes national_id_hash, unique among verified persons; keeps the result, not the face) · AuthSession · AuthEvent — each with its physical profile (Section 7), keys row (Section 8) and aggregate membership (Section 9) in the same change set (authority rule 6). Person.phone / phone_verified RELOCATED, Person.login_providers RETIRED, national_id_hash now unique among verified persons; six new edges in Section 5.PROP-067 อนุมัติและ apply — spec v0.42.0. เพิ่ม entity หกตัวในแกนอัตลักษณ์: PhoneNumber (UNIQUE e164 เฉพาะแถวที่ใช้งานอยู่ — ที่ลงใหม่ของข้อบังคับ NFR-14; มีเบอร์หลักหนึ่งเบอร์; การถอนมีระยะพัก) · ExternalIdentity (UNIQUE (provider, provider_subject); เก็บอีเมลไว้แสดงผล ไม่เป็นดัชนี) · Passkey (credential_id ไม่ซ้ำ; บันทึก flag การซิงก์ ไม่ใช้ปฏิเสธ) · IdentityCheck (บัตร + ตรวจสด; เขียน national_id_hash ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว; เก็บผล ไม่เก็บใบหน้า) · AuthSession · AuthEvent — ทุกตัวมาพร้อม physical profile (ข้อ 7) แถว key (ข้อ 8) และการสังกัด aggregate (ข้อ 9) ในชุดเดียวกัน (กติกาอำนาจข้อ 6) Person.phone / phone_verified ย้ายที่ Person.login_providers ยกเลิก national_id_hash ไม่ซ้ำในกลุ่มคนที่ยืนยันแล้ว; เพิ่มความสัมพันธ์หกเส้นในข้อ 5 |
| 0.8.0 | 2026-07-31 | PROP-068 approved & applied — spec v0.43.0. One entity enters the identity core: DeviceCredential (the THIRD entry factor — a key pair in the device keystore opened by the device biometric, the device screen lock or a six-digit app PIN; UNIQUE (person_id, device_key_hash); hardware_backed recorded and never used to refuse; enrolment_reversible_until carrying the published seven-day reversal) with its physical profile (Section 7), keys row (Section 8), aggregate membership (Section 9) and edge (Section 5) in the same change set (authority rule 6). Two applied columns are amended: AuthSession.auth_method becomes provider | passkey | device_key with phone_otp kept as a RETIRED enum member — historical rows stay readable and no new session is ever minted from a code (FR-377) — and AuthEvent.kind gains five kinds (challenge_raised · challenge_passed · challenge_failed · device_enrolled · device_enrolment_reversed) beside a new risk_signals column naming the published signal that raised a challenge (FR-382). AuthEvent.method keeps phone_otp in full standing: it is a verification method, and this is where it lives.PROP-068 อนุมัติและ apply — spec v0.43.0. เพิ่ม entity หนึ่งตัวในแกนอัตลักษณ์: DeviceCredential (ปัจจัยที่ให้เข้าตัวที่สาม — คู่กุญแจใน keystore ของเครื่อง เปิดด้วยชีวมาตรของเครื่อง ล็อกหน้าจอ หรือ PIN หกหลักของแอป; UNIQUE (person_id, device_key_hash); hardware_backed บันทึกไว้ ห้ามใช้ปฏิเสธ; enrolment_reversible_until ถือช่วงย้อนกลับเจ็ดวันที่ประกาศไว้) พร้อม physical profile (ข้อ 7) แถว key (ข้อ 8) การสังกัด aggregate (ข้อ 9) และเส้นความสัมพันธ์ (ข้อ 5) ในชุดการเปลี่ยนเดียวกัน (authority rule 6) แก้คอลัมน์ที่ apply แล้วสองรายการ: AuthSession.auth_method เป็น provider | passkey | device_key โดยเก็บ phone_otp เป็นสมาชิก enum ที่ยกเลิกแล้ว — แถวเก่าอ่านได้ และไม่มีเซสชันใหม่ใดสร้างจากรหัส (FR-377) — และ AuthEvent.kind เพิ่มห้าชนิด พร้อมคอลัมน์ใหม่ risk_signals ที่ระบุสัญญาณที่ประกาศไว้ซึ่งยกด่านขึ้น (FR-382) ส่วน AuthEvent.method ยังมี phone_otp เต็มสถานะ เพราะเป็นวิธียืนยัน และนี่คือที่ของมัน |
| 0.9.0 | 2026-08-03 | PROP-074 approved & applied — spec v0.45.0. Section 4 gains three entities — PersonCapacity · TenantQualification · PersonQualification — the two-axis model of A-78 (origin × holder) made concrete; Section 5 gains four edges including TenantCapacity → TenantQualification requires (FR-393); Section 7 gains three persistence profiles and re-shapes CapacityCompatibility → CompositionRule, first-class (three rules compile ~54 cells); Section 9 gains three single-row aggregate boundaries. Amended notes: TenantCapacity (the holder statement), Membership.is_self (written at tenant FOUNDING, not sign-up). Every standing's holder key is NOT NULL with a foreign key (NFR-141).PROP-074 อนุมัติและ apply แล้ว — spec v0.45.0 ข้อ 4 เพิ่มสามเอนทิตี ข้อ 5 เพิ่มสี่เส้นรวมถึง requires (FR-393) ข้อ 7 เพิ่มสามโปรไฟล์และเปลี่ยน CapacityCompatibility เป็น CompositionRule ข้อ 9 เพิ่มสามขอบเขต คีย์ผู้ถือของทุกสถานะเป็น NOT NULL และมี foreign key (NFR-141) |
| 0.10.0 | 2026-08-03 | PROP-075 approved & applied — spec v0.46.0. The tenant stops asserting what it is and the thing it holds is split on two axes. Tenant loses kind, legal_name?, registration_no? and base_province (A-81, R-CONTAINER): a tenant is a container of memberships, departments and sites and is never itself a natural person, a company, a cooperative or a government agency. Department and LegalEntity MERGE into Department (หน่วยงาน, DEP-########, A-82 R-ONETREE) — the business unit, self-parenting, optionally classified with a legal_form from the new legalForms register (11 rows + null, DATA under A-80), with PROP-026 OQ-14's THREE-TIER CAP WITHDRAWN for an 8-level operational guardrail (R-DEPTH, FR-395). Two new home entities: Site (SIT-########) — the physical location, FLAT, never a legal body, never a permission scope, one owning tenant — and DepartmentSite (DPS-########), the many-to-many presence row (A-83 R-SITE, R-PRESENCE). Uniqueness becomes PARTIAL and live-only: (legal_form, registration_no) and tax_id where legal_form IS NOT NULL, so one live department per registration, transferable by a recorded operator act that moves the subtree and its exclusive sites but NO records (NFR-141). department_id → department_id throughout, including SurfaceRoleGrant uniqueness (FR-63) and AuthSession.active_department_id; the scope axis is department and there is only ONE (R-ONESCOPE). New FR-394 (registered standing is derived, never written).PROP-075 อนุมัติและ apply — spec v0.46.0 Tenant เสีย kind legal_name? registration_no? และ base_province ส่วน Department กับ LegalEntity รวมเป็น Department (หน่วยงาน) และเพิ่ม entity บ้านใหม่สองรายการคือ Site กับ DepartmentSite พร้อมกันนั้น เพดานสามชั้นของ PROP-026 OQ-14 ถูกถอน เปลี่ยนเป็นแนวกันเชิงปฏิบัติการแปดชั้น (R-DEPTH, FR-395) (A-81 · A-82 · A-80 · FR-395 · A-83 · NFR-141 · FR-63 · FR-394) |
| 0.11.0 | 2026-08-03 | PROP-073 (spec v0.47.0): one word — Tenant. Party → Tenant, party_id (and every prefixed form) → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, party context/switcher → tenant context/switcher, cross-party → cross-tenant, organisation → organization, and ผู้เล่น retired as the Thai gloss (the Latin word tenant instead, R-THAI). Hold list untouched: counterparty · third party · tripartite working group · Person*/person_id; display codes and token claims were held by R-NULL for one release and then MOVED at v0.47.1 on client decision (C-1), because no token has ever been SIGNED — no auth exists in the built ocsb/ocsf prototypes — and the only printed codes were eight fixture strings in apps/ocsf/fund-shell.jsx, swept in the same pass: PTY- → TNT-, TCA- → TCA-, TQL- → TQL-, claim tnt → tnt, claim dep → dep. Carried in the same pass: the PROP-075 rectification — the retired directory noun domain becomes department (A-82 R-ONETREE) and the dangling A-86/A-87/A-88 citations are re-pointed at the ids they were actually given, A-81/A-82/A-83.PROP-073 (spec v0.47.0): คำเดียว — Tenant Party → Tenant, party_id ทุกรูป → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, cross-party → cross-tenant และเลิกใช้ ผู้เล่น เป็นคำแทนวัตถุนี้ในภาษาไทย (ใช้คำละติน tenant ตาม R-THAI) รายการห้ามแตะไม่ถูกแตะ: คู่สัญญา · third party · คณะทำงานไตรภาคี · Person*/person_id รอบเดียวกันแก้ค้างจาก PROP-075: domain → department (A-82) และแก้การอ้าง A-86/A-87/A-88 ที่ไม่มีอยู่จริงเป็น A-81/A-82/A-83 |
| 0.11.1 | 2026-08-03 | PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 as applicable): the identifiers v0.47.0 had held, moved on client decision. PTY-######## → TNT-######## · PCA-######## → TCA-######## · PQL-######## → TQL-######## · token claim pty → tnt · token claim dom → dep (v0.47.1, C-1 — R-NULL had held them as a stored VALUE and a wire format; reversed because no token has ever been signed and the only printed codes were fixture strings). quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2 — org is organization abbreviated, not a resemblance). The retired role LABEL swept as a phrase family and quota organization naming the tenant → quota group / กลุ่มโควตา (v0.47.3). All retired forms are in the FR-396 crosswalk and refused in new text by NFR-142.PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 ตามที่เกี่ยวข้อง): ตัวระบุที่ v0.47.0 คงไว้ ถูกย้ายตามการตัดสินของลูกค้า PTY- → TNT- · PCA- → TCA- · PQL- → TQL- · claim pty → tnt · claim dom → dep (v0.47.1, C-1) · quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2) · ป้ายชื่อบทบาทที่เลิกใช้และ องค์กรโควตา ที่เรียก tenant → กลุ่มโควตา (v0.47.3) ทุกรูปที่เลิกใช้อยู่ในตารางแปลง FR-396 |
| 0.11.2 | 2026-08-03 | Bilingual parity repair — spec v0.48.2 (patch). 4 .l-en/.l-th pairs in this document stated ids in English that the Thai half omitted; the Thai now carries every id its English states. Found by check V-5 of tools/validate.html (NFR-143, PROP-076, spec v0.48.0) and carried until now as a dated OVERRIDE in SPEC-APP-PLT Rev 0.9.0; this row discharges that override for this document. Thai is the primary language of this corpus, so a reader of the Thai half was missing facts the English half asserted. No model change: not one requirement, entity, event, state or number moved.ซ่อมความตรงกันสองภาษา — spec v0.48.2 (patch) คู่ .l-en/.l-th จำนวน 4 คู่ในเอกสารนี้ระบุรหัสในภาษาอังกฤษที่ฝั่งภาษาไทยไม่มี ตอนนี้ฝั่งภาษาไทยมีรหัสทุกตัวที่ภาษาอังกฤษระบุ พบโดยการตรวจ V-5 ของ tools/validate.html (NFR-143, PROP-076, spec v0.48.0) และถูกบันทึกเป็น OVERRIDE ที่มีวันที่ใน SPEC-APP-PLT Rev 0.9.0 มาจนถึงตอนนี้ แถวนี้ปลดการยกเว้นนั้นสำหรับเอกสารฉบับนี้ ภาษาไทยเป็นภาษาหลักของคลังเอกสารนี้ ผู้อ่านฝั่งภาษาไทยจึงขาดข้อเท็จจริงที่ภาษาอังกฤษยืนยันไว้ ไม่มีการเปลี่ยนแบบจำลอง: ไม่มี requirement เอนทิตี เหตุการณ์ สถานะ หรือตัวเลขใดขยับ |
| 0.11.3 | 2026-08-03 | Thai-half correction — spec v0.48.3 (patch). The PROP-075 revision row carried, in Thai, a leftover from a global rename sweep — “โดยเปลี่ยน department_id เป็น department_id ทั้งฉบับ”, a sentence that renames a thing to itself and states nothing. Replaced with the fact its English half states and the Thai omitted: PROP-026 OQ-14’s three-tier cap is WITHDRAWN for an eight-level operational guardrail (R-DEPTH, FR-395). Found while reading the pairs V-5 had flagged at spec v0.48.2.แก้ฝั่งภาษาไทย — spec v0.48.3 (patch) แถวประวัติของ PROP-075 ฝั่งภาษาไทยมีเศษจากการแทนที่คำทั้งไฟล์ — “โดยเปลี่ยน department_id เป็น department_id ทั้งฉบับ” ประโยคที่เปลี่ยนชื่อสิ่งหนึ่งเป็นตัวมันเองและไม่ได้บอกอะไร แทนด้วยข้อเท็จจริงที่ฝั่งภาษาอังกฤษระบุแต่ภาษาไทยขาดไป: เพดานสามชั้นของ PROP-026 OQ-14 ถูกถอน เปลี่ยนเป็นแนวกันเชิงปฏิบัติการแปดชั้น (R-DEPTH, FR-395) พบขณะอ่านคู่ที่ V-5 รายงานไว้ที่ spec v0.48.2 |
| 0.12.0 | 2026-08-04 | OQ review pass 4 approved & applied — spec v0.49.0. Section 6.1 is new and is the point of the release: the permanent bidirectional naming crosswalk FR-396 has claimed since v0.47.0 to publish HERE is now actually rendered here — it existed only in the graph, so a reader of the documents could not resolve a retired noun in one lookup and the requirement's own metric failed (recorded as F-10). The crosswalk gains the fourth retired noun, CONFIRMED by the client (C-4): Domain → Department with domain_id, parent_domain_id, domain_path, site domain, DomainCreated, DomainReparented and โดเมน as the organizational unit — retired by the pass on its own reading of A-82 (R-ONETREE) and now instructed rather than inferred, with the whole DDD sense of the word held. A-82 records the confirmation. One live identifier still spelled it and was swept in the same pass: grp.dir.domainSwitch → grp.dir.departmentSwitch (F-11), whose English and Thai copy already said department.ทบทวนคำถามเปิดรอบ 4 อนุมัติและ apply — spec v0.49.0 ข้อ 6.1 เป็นของใหม่และเป็นสาระของรุ่นนี้: ตารางแปลงชื่อถาวรสองทิศทางที่ FR-396 อ้างตั้งแต่ v0.47.0 ว่าเผยแพร่ที่นี่ ถูก render จริงแล้ว — ก่อนหน้านี้อยู่แต่ในกราฟ ผู้อ่านเอกสารจึงค้นครั้งเดียวไม่ได้ และ metric ของข้อกำหนดเองไม่ผ่าน (บันทึกเป็น F-10) ตารางเพิ่มคำนามที่สี่ ซึ่งลูกค้ายืนยันแล้ว (C-4): Domain → Department พร้อม domain_id · parent_domain_id · domain_path · site domain · DomainCreated · DomainReparented และ โดเมน ในความหมายหน่วยงาน — รอบนี้เลิกใช้จากการอ่าน A-82 เอง ตอนนี้เป็นคำสั่งไม่ใช่การอนุมาน โดยคงความหมายเชิง DDD ไว้ทั้งหมด A-82 บันทึกการยืนยันไว้ และมีตัวระบุที่ยังสะกดคำนั้นหนึ่งจุดถูกกวาดในรอบเดียวกัน: grp.dir.domainSwitch → grp.dir.departmentSwitch (F-11) ซึ่งข้อความอังกฤษและไทยของมันเขียนว่า department อยู่แล้ว |
| 0.13.0 | 2026-08-04 | PROP-072 approved & applied — spec v0.50.0. One new home entity, MemberInvitation (MIN-########), with its Section 4 row, its two Section 5 edges and its full Section 7 persistence profile in the SAME change set (authority rule 6). It carries what the applied model had no object for: a tenant admitting a PERSON to a POSITION. Three details are load-bearing. (1) issued_by is a MEMBERSHIP, not a person, so the authority is the position and the invitation survives the issuer leaving. (2) target_kind is phone | provider_email (PROP-072 OQ-8, client direction against the recommendation): a provider-email target is accepted only by signing in with the external identity provider that owns the address, so the email is an ADDRESS and never an identity and NFR-14 uniqueness, recovery and the Person key are untouched. (3) Z-2 is a SCHEMA fact — a partial unique index on (tenant_id, target_hash) WHERE status = issued — rather than a screen rule. The Membership row gains the amendment that finally gives status = invited a producer and an expiry, and the Tenant → Membership rule is re-worded: the contact target is the DELIVERY of an invitation, not its model, and no act may leave a tenant with zero active owner memberships (FR-407). Counts corrected 17 → 18 (Section 1) and 18 → 19 (Section 7).PROP-072 อนุมัติและ apply แล้ว — spec v0.50.0 เพิ่ม entity ที่ home อยู่ฉบับนี้หนึ่งรายการ MemberInvitation (MIN-########) พร้อมแถวในข้อ 4 เส้นความสัมพันธ์สองเส้นในข้อ 5 และ persistence profile เต็มในข้อ 7 ในชุดการเปลี่ยนแปลงเดียวกัน (กฎอำนาจข้อ 6) มันถือสิ่งที่แบบจำลองที่ apply แล้วไม่มีวัตถุรองรับ: tenant รับคนเข้าสู่ตำแหน่ง มีสามจุดที่เป็นสาระ (1) issued_by เป็นสมาชิกภาพ ไม่ใช่ตัวคน อำนาจจึงอยู่ที่ตำแหน่งและคำเชิญอยู่รอดเมื่อผู้ออกลาออก (2) target_kind เป็น phone | provider_email (PROP-072 OQ-8 คำสั่งลูกค้าสวนคำแนะนำ) ปลายทางแบบอีเมลตอบรับได้ด้วยการเข้าสู่ระบบผ่านผู้ให้บริการตัวตนภายนอกที่เป็นเจ้าของที่อยู่นั้นเท่านั้น อีเมลจึงเป็นที่อยู่ ไม่ใช่ตัวตน และความไม่ซ้ำตาม NFR-14 การกู้คืน และกุญแจของ Person ไม่ถูกแตะ (3) Z-2 เป็นข้อเท็จจริงของโครงสร้าง — partial unique index บน (tenant_id, target_hash) WHERE status = issued — ไม่ใช่กฎของหน้าจอ แถว Membership ได้ข้อความแก้ไขที่ทำให้ status = invited มีผู้ผลิตค่าและวันหมดอายุ และกฎ Tenant → Membership ถูกเขียนใหม่: ปลายทางติดต่อเป็นการส่งคำเชิญ ไม่ใช่ตัวแบบจำลอง และไม่มีการกระทำใดทำให้ tenant เหลือสมาชิกภาพ owner ที่ใช้งานอยู่เป็นศูนย์ได้ (FR-407) แก้จำนวน 17 → 18 (ข้อ 1) และ 18 → 19 (ข้อ 7) |
| 0.14.0 | 2026-08-04 | PROP-071 approved & applied — spec v0.52.0. Two new home entities: Referral (RFR-######## — one durable, MULTI-USE, UNTARGETED eight-character code per PERSON in his farming capacity, the fourth cell of A-91 and the one that admits nothing) and ReferralCredit (RFC-######## — one row per referred person, UNIQUE on referred_person_id, a NULL code on a decline, never shown to the holder of the code). Three edges — Person → Referral 1—0..1, Referral → ReferralCredit 1—0..*, Person → ReferralCredit 1—0..1 — and two column-level persistence profiles in Section 7, both PDPA personal, each in its own aggregate outside every tenant root. Neither table may be joined into a relationship: no membership, no capacity, no stewardship, no registration_status (FR-409).PROP-071 อนุมัติและ apply — spec v0.52.0 เอนทิตีใหม่สองตัวที่มีบ้านในเอกสารนี้: Referral (หนึ่งรหัสถาวรแปดตัวอักษรต่อหนึ่งคนในฐานะผู้ปลูก ใช้ได้หลายครั้ง ไม่มีปลายทาง) และ ReferralCredit (หนึ่งแถวต่อหนึ่งผู้ถูกแนะนำ UNIQUE บน referred_person_id รหัสว่างเมื่อปฏิเสธ ห้ามแสดงให้ผู้ถือรหัสเห็น) สามเส้นความสัมพันธ์ และโปรไฟล์การจัดเก็บระดับคอลัมน์สองชุดในข้อ 7 ทั้งคู่เป็น PDPA personal และอยู่ใน aggregate ของตัวเองนอก root ของ tenant ทุกตัว ห้ามเชื่อมตารางทั้งสองเข้าเป็นความสัมพันธ์ใด ๆ (FR-409) |
| 0.15.0 | 2026-08-06 | PROP-070 approved & applied — spec v0.53.0. New entity OnboardingSession (route · current step · steps completed · steps skipped) with its physical profile and its own aggregate root (authority rule 6), homed here; Person.id_verified_level gains the ETDA IAL mapping rows (FR-421, map — do not rename); IdentityCheck at purpose = admission is now produced by the onboarding spine and not only by recovery.PROP-070 อนุมัติและ apply — spec v0.53.0 เอนทิตีใหม่ OnboardingSession พร้อม profile ทางกายภาพและ aggregate root ของตัวเอง (กฎอำนาจข้อ 6) บ้านอยู่ที่นี่ · Person.id_verified_level เพิ่มแถวเทียบ IAL ของ ETDA (FR-421) · IdentityCheck ที่ purpose = admission มีผู้ผลิตจากแกนการสมัครแล้ว ไม่ใช่เฉพาะการกู้คืน |
| 0.16.0 | 2026-08-07 | PROP-078 approved & applied — spec v0.54.0. Person.full_name is RETIRED and the name is stored in PARTS — name_prefix? · first_name · last_name — beside nickname?, birth_date and the declared contact location province · amphor? · tumboon? (FR-437 · FR-438 · FR-439). Fig. 1, the Section 4 entity row and the Section 7 column table follow, and the Person row’s stale phone / login_providers sentence — left behind by v0.42.0 — is rewritten with it. IdentityCheck gains card_birth_date? and birth_date_match?: the card read already extracted the date and nothing held it. NEW Section 4.1 — the namePrefixes register, six rows, data and never a compiled enum (A-80).PROP-078 อนุมัติและ apply — spec v0.54.0 Person.full_name ยกเลิก ชื่อเก็บเป็นส่วนย่อย — name_prefix? · first_name · last_name — พร้อม nickname? birth_date และที่อยู่ติดต่อที่แจ้งไว้ province · amphor? · tumboon? (FR-437 · FR-438 · FR-439) รูปที่ 1 แถวเอนทิตีในข้อ 4 และตารางคอลัมน์ในข้อ 7 ปรับตาม พร้อมเขียนประโยค phone / login_providers ที่ค้างจาก v0.42.0 ใหม่ IdentityCheck เพิ่ม card_birth_date? และ birth_date_match? เพิ่มข้อ 4.1 ทะเบียน namePrefixes หกแถว เป็นข้อมูล ไม่ใช่ enum (A-80) |
| 0.17.0 | 2026-08-18 | PROP-084 approved & applied — spec v0.75.0: the legal layer, inside the tenant. New Section 15 publishes A-111’s nine rules, the three tenant-side records with their persistence profiles, the four-state verification model, the permanent crosswalk out of Department’s five retired legal attributes and two retired partial uniques, the four stated amendments to applied material, and check V-20’s nine legs. Sections 4 and 2 re-read: Department keeps department_id · tenant_id · parent_department_id? · department_path · status and no legal mirror. Related documents → 16, Revision history → 17; no earlier address moved. The external reference is published in SPEC-ERD-GRP Section 9 and the uniqueness index in SPEC-ERD-PLT Section 5.PROP-084 อนุมัติและ apply — spec v0.75.0 ชั้นนิติบุคคล ภายใน tenant ข้อ 15 ใหม่ เผยแพร่กฎเก้าข้อของ A-111 ระเบียนฝั่ง tenant สามรายการพร้อม persistence profile แบบจำลองการตรวจสี่สถานะ ตารางแปลงถาวรจาก attribute ทางกฎหมายห้าตัวและคีย์ไม่ซ้ำสองชุดที่ยกเลิกจาก Department การแก้สิ่งที่ apply แล้วสี่ข้อ และเก้าขาของ V-20 เอกสารที่เกี่ยวข้อง → 16 ประวัติการแก้ไข → 17 |