Glossary & cross-cutting data dictionary
Terms and shared data shapes that recur across domains. Module-specific fields are defined in each module doc; this captures the vocabulary and the conventions every doc assumes.
| Term |
Meaning |
| Tenant |
An isolated installation = one backend + one admin process + one MongoDB database. No business collection carries a tenant id; isolation is at the DB connection. See multi-tenancy. |
| Master DB |
Platform-level database (mongodb_master_url) holding the tenants registry: limits, feature whitelist, suspended flag. |
| Company |
A legal entity within a tenant. Documents carry companyId. A tenant may run several companies/subsidiaries (parentId tree). |
| Branch |
An operating unit within a company; documents often carry branchId. |
| Store |
A warehouse/stock location; legacy naming where store == Branch == warehouse. Stock is scoped by branchId. |
Context (ApContextService) |
Per-request bag holding userId, companyId, branchId, employeeId, role/permission info; populated from the JWT. |
| Feature flag / whitelist |
A capability gate. Resolved as plan catalog ∩ tenant whitelist (dedicated dev mode grants all). See subscription-features. |
Base schema (every collection)
BaseSchema (from zync-nest-data-module) provides:
| Field |
Meaning |
_id |
Mongo ObjectId (internal). |
ref |
Public reference id (used in URLs/printouts instead of _id). |
companyId / branchId |
Scoping; injected from context on writes, filtered on reads (company active; branch read-filter dormant). |
createdAt / updatedAt |
Timestamps. |
createdBy / updatedBy |
Actor refs (where populated). |
| soft-delete fields |
Via mongoose-delete — rows are flagged deleted, not removed. |
Accounting
| Term |
Meaning |
| AccountTransaction |
One GL ledger leg: a single debit OR credit against one Account. The source of truth for balances. |
| Normal balance |
Whether an account increases on debit or credit, decided by its category type (ASSET/EXPENSE/INVENTORY increase on debit; LIABILITY/EQUITY/INCOME on credit). |
| Balance derivation |
Σ(debits) − Σ(credits) or the reverse by type — never a stored number. POSTED-only for reports. |
refId |
On a transaction leg: the parent document _id (journal/contra/payment/order/asset…). |
relationId |
The id linking a balanced set of legs (the legs that must net to zero together). |
kind |
Discriminator on a transaction/stock row identifying which document produced it (JournalEntry, ContraEntry, PaymentEntry, SalesInvoice, …). |
| POSTED vs SAVED |
Document lifecycle: SAVED (draft, editable) → POSTED (locked into reported balances). |
| Report section |
The financial-statement bucket an account category maps to (drives Trial Balance/P&L/Balance Sheet). See reporting-framework. |
| safeRate |
FX guard: a 0/null exchange rate is coerced to 1 to avoid divide-by-zero in conversion. |
Inventory & costing
| Term |
Meaning |
| Stock row |
One inventory movement: type: IN (+qty) or type: OUT (−qty) at a branch for an item. |
| On-hand |
Derived: Σ IN − Σ OUT per item per branch. No mutable quantity field. |
| ATP (available-to-promise) |
on-hand − active reservations (reservations live in a separate collection). |
| FIFO cost layers |
Per-item ordered cost batches (costLayers[]); sales consume oldest-first. |
| AVCO |
Weighted-average cost = Σ amount / Σ netQty, recomputed on purchase. |
| COGS |
Cost of goods sold leg posted on a sale (DR COGS / CR Inventory). |
| Landed cost |
Extra acquisition costs (freight, duty) allocated proportionally across receipt lines. |
| Order (engine) |
A polymorphic Order/OrderItem document; kind selects purchase vs sales vs quote vs return behavior. |
HR / payroll (Malaysia)
| Term |
Meaning |
| ESS |
Employee Self-Service — a separate employee login (Employee ref + PIN) and PWA; an employee sees only their own rows. |
| EPF |
Employees Provident Fund (statutory retirement contribution). |
| SOCSO |
Social Security Organisation contribution. |
| EIS |
Employment Insurance System contribution. |
| PCB / MTD |
Monthly tax deduction (Potongan Cukai Bulanan) computed by the LHDN "computerised method". |
| Attendance group → shift → timetable |
Chain that defines an employee's working days/hours; the working-day set drives leave duration and payroll proration. |
Authorization & workflow
| Term |
Meaning |
| Permission module |
A protectable area (one of the ~75 ApModules). |
| Permission action |
An operation (view/create/update/delete/…); enforced via RoleActions. |
| Access group |
A role = a named set of module→action grants; a user belongs to one (Staff resolve theirs via their Employee). |
@ApGqlAuthorize() |
Resolver decorator that enforces a required module+action against the user's access group; SuperAdmin bypasses. |
| CASL ability |
The in-memory ability object built per user from their grants (grant-presence only; no deny rows). |
| Workflow / stage / approver |
The generic approval engine: an ordered chain of workflow_tasks (one stage each) with approvers; on final approve/reject it calls back the source document to flip its status. See workflow-approval-engine. |
@AuditMeta({module, action}) |
Marks a mutation for the audit interceptor to record who/what/when. See audit-trail. |
Users (unified collection)
| Term |
Meaning |
users collection |
One collection discriminated by kind (UserKindTypes): operators, employees (Staff), customers, suppliers all live here. |
| Trading partner |
A customer or supplier — a users row whose AR/AP balance is derived from GL legs scoped by payeeId. See crm. |
No docs match your search.