Skip to content

feat(api): InventoryTransaction endpoints (4 of 4 newly-migrated tables)#52

Merged
CryptoJones merged 1 commit into
masterfrom
feat/inventory-transaction-endpoints
May 17, 2026
Merged

feat(api): InventoryTransaction endpoints (4 of 4 newly-migrated tables)#52
CryptoJones merged 1 commit into
masterfrom
feat/inventory-transaction-endpoints

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Closes #49.

Summary

Final entity from the migration. Direct compId scoping (invtCompanyId) — same auth shape as Worker.

  • POST /v1/inventorytransaction
  • GET /v1/inventorytransaction/:id
  • GET /v1/inventorytransaction/bycompany/:id (newest first)
  • PATCH /v1/inventorytransaction/:id
  • DELETE /v1/inventorytransaction/:id (soft-delete via invtArch)

After this merges, every BACPAC table has API endpoints. The 4-table rollout (#49) is complete.

invtDirection constrained to 0 (inbound) or 1 (outbound) at the zod boundary.

Test plan

  • vitest: 28 files / 199 passing (was 27 / 191)
  • Auth-contract + body validation (including the 0|1 enum)
  • Live PG integration with the migration applied

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

Final entity from the 20260517000000 migration. Direct compId
scoping via invtCompanyId — same auth shape as Worker.

  POST    /v1/inventorytransaction
  GET     /v1/inventorytransaction/:id
  GET     /v1/inventorytransaction/bycompany/:id   (newest first)
  PATCH   /v1/inventorytransaction/:id             (see note)
  DELETE  /v1/inventorytransaction/:id             (soft-delete via invtArch)

Note on PATCH/DELETE: production accounting systems usually prefer
reversing entries on a movement log rather than mutating existing
rows. The endpoints are exposed for surface parity with the rest
of the API; operators wanting audit-grade behavior can disable
PATCH/DELETE at the reverse-proxy layer.

invtDirection is constrained to 0 (inbound / received) or 1
(outbound / consumed) at the zod boundary. invtCompanyId is
not patchable (would break auth invariants).

After this lands, every BACPAC table has API endpoints. Tracker
#49 can close.

Tests: 28 files / 199 tests (was 27 / 191).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 60f89fc into master May 17, 2026
@CryptoJones CryptoJones deleted the feat/inventory-transaction-endpoints branch May 17, 2026 23:55
CryptoJones added a commit that referenced this pull request May 17, 2026
)

Continues the housekeeping pattern of #44 — keep the README endpoint
table and CHANGELOG \`[Unreleased]\` in sync with merged PRs.

README:
  - Append rows for the four PurchaseOrder/Inventory entities
    that gained endpoints in #50, #51, #52.

CHANGELOG (under \`[Unreleased]\`):
  - PurchaseOrder + Inventory API rollout (the tracker, #49, and
    its three PRs)
  - JSON_BODY_LIMIT env hook (#45 / #46 / #47)
  - npm audit fix + dep bumps + Snyk PR triage (#30 / #48)

Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API surface for the 4 newly-migrated tables (PurchaseOrders + InventoryTransactions)

1 participant