Projects

Projects group work for reporting and cost roll-up. The SDK exposes read-only access to v_projects (list, getById). There are no create/update/delete RPCs on the public API yet—manage project rows via service-role or internal tooling until those RPCs exist.

Overview

Set tenant context before calling these methods. Rows include id, tenant_id, name, code, description, created_at, and updated_at.

List projects

client.projects.list()

const projects = await client.projects.list()
// Returns ProjectRow[]

Get by ID

client.projects.getById(id)

const project = await client.projects.getById('uuid-of-project')
// Returns ProjectRow | null

Work orders and cost roll-up

Pass projectId when creating a work order so labor, parts, and vendor costs roll up under that project. Use client.costs.costRollup() with groupBy: 'project' for aggregates.

Work order linked to a project

await client.workOrders.create({
  tenantId: 'uuid-of-tenant',
  title: 'Overhaul pump P-101',
  projectId: 'uuid-of-project',
  // ...priority, status, etc.
})

Was this page helpful?