Skip to content

TimeEntry: resolve schema/API drift for job/worker/billtype fields #372

Description

@CryptoJones

Summary

The Sequelize model defines legacy billing linkage columns (teJobId, teWorkerId, teBillTypeId, teInvoiceJobId), but other layers are out of sync.

Current drift

Layer Status
setup/TimeEntry.sql Only teCustId FK; no job/worker/billtype columns
app/config/db.config.js No TimeEntry ↔ Job/Worker/BillingType/InvoiceJob associations
timeentrycontroller.js Create/update whitelist excludes those fields
CSV export Omits those columns

Risk

Fresh installs from baseline SQL may diverge from migrated DBs; API clients cannot read/write billing linkage; model and physical schema can drift.

Acceptance criteria

Pick one direction and finish it end-to-end:

  • Full restore: migration + baseline SQL + zod schemas + controller whitelist + associations + OpenAPI + CSV + integration tests
  • Intentional sever: remove columns from model (or mark deprecated), document the break, migration to drop unused columns if present in prod

Source

Code review backlog (2026-06-23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions