Deal Update Change Logger (deals/dealUpdateChangeLog.ts)

warpdrive · src/features/deals/dealUpdateChangeLog.ts · typescript · MIT
database, crm, infra

Records atomic changes to deal records in a database, ensuring only modified fields are logged during update transactions.

// Source: https://github.com/sneg55/warpdrive | License: MIT | Copyright 2026 Nikita Sawinyh
// Provided via justclaw.it.com; keep this notice with the code.
// Change-log writes for updateDeal, extracted to keep dealUpdate.ts under the size/complexity
// caps. Every row is written on the caller's transaction (atomic with the UPDATE) and only when
// the field was present in the input AND its value actually changed (a no-op edit logs nothing).
import {
  CHANGE_FIELD_EXPECTED_CLOSE,
  CHANGE_FIELD_ORG,
  CHANGE_FIELD_PERSON,
  CHANGE_FIELD_SOURCE_CHANNEL_ID,
  CHANGE_FIELD_TITLE,
  CHANGE_FIELD_VALUE,
  customFieldChangeField,
} from "@/constants/changeLogFields";
import type { deals } from "@/db/schema/deals";
import { recordChange } from "@/features/collaboration/changeLog";
import type

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key