Data Model
Core entity relationships and database concepts.
Data Model
This page documents the high-value entity relationships needed to understand the platform.
Client configuration cluster
Client is the owner of most reusable configuration:
Projectrecords throughClient.projectsClientMembershiprows for client-scoped accessClientRaterows for base/classification ratesClientAllowancerows for allowance matrix rulesClientMaterialrows for materialsClientCostCoderows for cost codesClientWorkConditionrows for work condition flagsClientExpenseCategoryrows for expense category setup- Admin and assigned user many-to-many relationships
This is why most setup pages live under /admin/clients/{id} or client-scoped portal routes.
Project operational cluster
Project belongs to a Client and anchors operational submissions:
Project.timesheetsProject.expensesProject.clientSupervisorsProjectassigned electricians/usersProject.attachmentsProjectExpenseCategorylinks- JSON configuration such as
allowances_data, locations, materials, and cost-code exposure
Project allowance settings are not the same as client allowance rules. Client allowances define the rule, amount, trigger, and mode. Project allowances decide project-level eligibility, project-specific rate/type overrides, and apply toggles.
Timesheet cluster
Timesheet is the main workflow record:
Timesheet.useris the electrician or owner.Timesheet.projectpoints to the project and client context.Timesheet.entriesstores date/start/end rows and per-entry selections.Timesheet.attachmentsstores uploaded evidence.Timesheet.changeLogsstores edit audit rows.Timesheet.approvalSheetItemslinks a timesheet into supervisor approval sheet workflows.Timesheet.allowanceLinesstores calculated allowance results.Timesheet.calculationsstores award snapshots.Timesheet.riskAssessmentstores risk scoring output.
Timesheet statuses are draft, submitted, accepted, approved, and rejected.
Time entry cluster
TimeEntry belongs to a timesheet and can optionally link to an expense. It carries the detailed submitted work data:
- date, start time, end time
- job code and cost code
- vehicle type
- shift work flag and description
allowances_datafor selected/manual allowancesmaterials_datafor materials usedwork_conditions_datafor flags such as breaks, callouts, night shift, or dirty work- attachments through
Attachment
Calculation records
TimesheetAllowanceLine is generated by the allowance matrix. It stores:
- timesheet and optional time entry
- optional source
ClientAllowance - name and code
- amount unit
- quantity, unit rate, amount
- trigger reason
- taxable and billable flags
sourceSnapshotcontaining trigger type, mode, config, EAB state, and matched metadata
TimesheetCalculation is generated by the award calculator. It stores snapshot totals and owns TimesheetCalculationLine rows with types such as ordinary, minimum shift, break, overtime, Saturday, Sunday, shift loading, public holiday, allowance, travel, callout, expense, and billing.