Commit Graph

174 Commits

Author SHA1 Message Date
HoloPanio 87cce83030 fix(dalpuri): correct UTC timestamp field names in smart sync
Fixed field name mismatches for tables with lastUpdatedUTC (all-caps):
- IV_Product: lastUpdateUtc → lastUpdatedUTC
- Department: lastUpdateUtc → lastUpdatedUTC

These field names must match the Prisma schema exactly (case-sensitive).
Ensures smart sync decision logic can correctly probe for record updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 21:28:22 -05:00
HoloPanio 688a9096c2 refactor(api): started implementing all of the tables needed for full data synchronization
BREAKING CHANGE: refer to body
2026-03-22 20:48:29 -05:00
HoloPanio 6b7eec67b8 fix: remove nested .git folders, re-add as normal directories 2026-03-22 17:50:47 -05:00
HoloPanio f55c7e47c9 chore:update everything 2026-03-22 17:47:03 -05:00
HoloPanio cb71133186 chore: add EVERYTHING 2026-03-22 17:44:44 -05:00
HoloPanio 91fa272fe6 chore: add EVERYTHING 2026-03-22 17:43:55 -05:00
HoloPanio 5ea7bb8f95 chore: import history from ui 2026-03-22 17:43:23 -05:00
HoloPanio 9fed61de68 chore: import history from api 2026-03-22 17:41:40 -05:00
Jackson ec4c8da786 Initial commit 2026-03-22 17:21:08 -05:00
HoloPanio 2f17f24b3b fix: ship sales tax rates with production runtime v0.1.23 2026-03-16 11:25:12 -05:00
HoloPanio 1230dacfa2 build: include logo.png in runtime image v0.1.22 2026-03-15 23:55:46 -05:00
HoloPanio 005e939a54 Swap Quick Add and Add to Cart button order in detail pane
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-15 23:53:41 -05:00
HoloPanio 85fa991c30 Sales opportunity enhancements and unsaved changes guard
- Add unsaved changes guard (UnsavedChangesDialog, EditGuard, dirtyState store)
- Add Breadcrumb component
- Add EmailText component
- Update sales opportunity detail with new tabs and workflow
- Add dashboard tab to sales page with metrics
- Update opportunity API URLs to include /opportunity/ path segment
- Add auth token refresh endpoint
- Add credential-types API endpoint
- Add CW members store
- Add sales-utils helpers
- Update layout server to return user info alongside canViewAdmin
- Fix unit tests to match updated API paths and return shapes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-15 23:43:34 -05:00
HoloPanio 1dc3c7ce07 test: align review approval status with ReadyToSend v0.1.21 2026-03-15 23:43:16 -05:00
HoloPanio e764932c39 feat: expand sales opportunity workflow and metrics APIs v0.1.20 2026-03-15 23:38:56 -05:00
HoloPanio e74611cd96 refactor: extract reusable UI components and shared utilities 2026-03-12 22:47:06 -05:00
HoloPanio 33b34d08a7 Add migration for CwMember table
Creates the CwMember table migration that was missing from the migration history
(previously applied locally via db push but never migrated for production).
v0.1.19
2026-03-09 17:59:17 -05:00
HoloPanio 7ffbd98f2e feat: add taxableFlag editing and improve add-products UX
- Make taxableFlag editable in opportunity product detail view
- Normalize salesTaxable → taxableFlag in procurement catalog API
- Add taxableFlag to EditOpportunityProductBody interface
- Add loading spinner and disable button during 'Add Selected Items'
- Prevent double-submit on add-selected-items action
2026-03-09 17:49:28 -05:00
HoloPanio 5afda8cb34 Add taxableFlag to product updates, QUO-Narrative quote fallback, and orphan reconciliation
- Add taxableFlag boolean field to product update schema and forecast patch
- Fall back to QUO-Narrative product customerDescription for quote narrative
- Reconcile orphaned local opportunity records not found in CW during refresh
- Invalidate caches for removed orphaned opportunities
- Add reconciled event and orphanedCount to refresh events
- Update API_ROUTES.md with taxableFlag field documentation
v0.1.18
2026-03-09 17:48:47 -05:00
HoloPanio ee3e0a7377 bypass checkColdStatus — always returns not-cold until feature ready v0.1.17 2026-03-09 03:33:59 -05:00
HoloPanio e294791858 fix: provide real checkColdStatus in wfOpportunity mock, remove stray closing brace 2026-03-09 03:29:00 -05:00
HoloPanio 97ac4a2173 fix: eliminate cross-file mock.module pollution — complete exports for all mocked modules 2026-03-09 03:26:22 -05:00
HoloPanio ad7507d133 fix: use real cache key prefixes in mock and dynamic imports for CI compatibility 2026-03-09 03:08:15 -05:00
HoloPanio 15ef24eb3e fix: resolve CI test failures — explicit cache mock exports, hoisted service mocks, pinned Bun 1.3.6 2026-03-09 03:03:06 -05:00
HoloPanio f53b390e18 feat: add opportunity workflows, delete routes, company sites, algorithms, and expanded test coverage 2026-03-09 02:56:08 -05:00
HoloPanio 02dc4f0305 fix: rename +-prefixed spec files to prevent SvelteKit build errors
SvelteKit rejects files with + prefix in routes/ during vite build.
Renamed all +*.spec.ts files to drop the + prefix (e.g. +page.server.spec.ts → page.server.spec.ts).
This fixes both Docker and Electron Forge builds.
2026-03-09 02:30:10 -05:00
HoloPanio 025e4e8a44 fix: exclude test/spec files from Docker build context 2026-03-09 02:20:23 -05:00
HoloPanio 7073f5aa33 feat: add workflow actions, admin enhancements, and comprehensive test coverage 2026-03-09 02:14:08 -05:00
HoloPanio 5169107a04 feat(sales): enhance opportunity management and add CW integration 2026-03-07 18:16:14 -06:00
HoloPanio c0a4d4f919 feat: add CW members, opportunity create/update, and integrator interceptor v0.1.16 2026-03-07 18:15:17 -06:00
HoloPanio 0ce1eda606 fix: add missing GeneratedQuotes columns migration v0.1.15 2026-03-07 00:14:26 -06:00
HoloPanio 6c310ed753 fix: add missing probability column migration for Opportunity v0.1.14 2026-03-07 00:07:10 -06:00
HoloPanio b735981b6b feat(sales): add quotes tab, PDF viewer, and opportunity sidebar enhancements 2026-03-06 23:49:27 -06:00
HoloPanio 1907bb433b feat: restructure sales, add PDF quote generation and WebSocket support v0.1.13 2026-03-06 23:25:37 -06:00
HoloPanio 762edd8eb7 feat(sales): update opportunity product and overview flows 2026-03-04 18:44:29 -06:00
HoloPanio 4efca6cc53 Add sales item labor/product route updates and permission docs 2026-03-04 18:43:54 -06:00
HoloPanio d5c22c8eff Add special-order product flow for sales opportunities v0.1.12 2026-03-04 00:11:40 -06:00
HoloPanio e04a1ad746 Add special-order product flow and improve opportunity product sequencing 2026-03-04 00:11:36 -06:00
HoloPanio a048e1e824 feat: add CW callback route and optimize cache refresh workflows v0.1.11 2026-03-03 19:46:48 -06:00
HoloPanio c628a78b27 feat: enhance opportunity detail and sales flow 2026-03-03 19:46:12 -06:00
HoloPanio 6d935e7180 feat: Redis opportunity cache, CW API retry/logging, adaptive TTLs
- Add Redis-backed opportunity cache with background refresh (30s interval)
- Fix concurrency bug: use lazy thunks instead of eager promises for batching
- Add withCwRetry utility with exponential backoff for transient CW errors
- Add adaptive TTL algorithms (primary, sub-resource, products) based on opportunity activity
- Add include query param on GET /sales/opportunities/:id (notes,contacts,products)
- Add opt-in CW API logger (LOG_CW_API env var) with timestamped files in cw-api-logs/
- Add debug-scripts/analyze-cw-calls.py for API call analysis
- Add computeSubResourceCacheTTL and computeProductsCacheTTL algorithms with tests
- Increase CW API timeout from 15s to 30s
- Unblock cache refresh from startup chain (remove await)
- Prioritize recently updated opportunities in refresh cycle
- Add CACHING.md documentation
- Update API_ROUTES.md with caching details and include param
- Update copilot instructions to require CACHING.md sync
- Add dev:log script for CW API call logging during development
v0.1.10
2026-03-02 23:23:24 -06:00
HoloPanio fe71248e88 perf: cache-only strategy for list views, cache-then-cw for single fetch
- Add data-source hierarchy to opportunity manager (cache-only, cache-then-cw, cw-first)
- fetchPages/search/fetchByCompany use cache-only: Redis → DB (no CW calls)
- fetchItem uses cache-then-cw by default, cw-first when fresh=true
- Add idleTimeout: 255 to Bun.serve to prevent request timeouts
- Map CW status 57 (04. Confirmed Quote) to Active equivalency
- Add computeCacheTTL algorithm and opportunityCache module
v0.1.9
2026-03-02 21:12:44 -06:00
HoloPanio 7411310083 fix: add migration for missing columns (cwIdentifier, catalog categories, productSequence) v0.1.8 2026-03-01 18:28:05 -06:00
HoloPanio 9145ea5ba4 feat(sales): cancellation awareness in forecast summary, productSequence ordering
- Show fully/partially cancelled products in forecast summary table
- Add cancellation KPI card with full/partial breakdown
- Fully cancelled rows: strikethrough + reduced opacity + red badge
- Partially cancelled rows: amber border + badge + effective/total qty
- Add productSequence prop to ProductsTab for custom ordering
- Fall back to CW sequenceNumber when no productSequence set
- Add productSequence field to SalesOpportunity interface
2026-03-01 18:02:46 -06:00
HoloPanio 30b408e0db feat: add product to opportunity route, local product sequencing
- Add POST /v1/sales/opportunities/:identifier/products with field-level permission gating
- Add CWForecastItemCreate type for forecast item creation
- Store product display order locally (productSequence Int[] on Opportunity)
- Rewrite resequenceProducts to be local-only (no CW PUT, stable IDs)
- Remove reorderProducts CW util (PUT regenerated IDs & broke procurement)
- Update fetchProducts to apply local ordering with CW sequenceNumber fallback
- Add productSequence to OpportunityController.toJson()
- Update API_ROUTES.md, PERMISSIONS.md, PermissionNodes.ts
v0.1.7
2026-03-01 18:01:02 -06:00
HoloPanio d7b374f8ab feat: sales activities, forecast products, catalog categories, member cache, procurement filters, and comprehensive tests
New features:
- ActivityController and manager for CW sales activities (CRUD)
- ForecastProductController for opportunity forecast/product lines
- CW member cache with dual-layer (in-memory + Redis) resolution
- Catalog category/subcategory/ecosystem taxonomy module
- Quote statuses type definitions with CW mapping
- User-defined fields (UDF) module with cache and event refresh
- Company sites CW module with serialization
- Procurement manager filters (category, ecosystem, manufacturer, price, stock)
- Opportunity notes CRUD and product line management via CW API
- Opportunity type definitions endpoint

Updates:
- OpportunityController: CW refresh, company hydration, activities, custom fields
- UserController: cwIdentifier field for CW member linking
- CatalogItemController: category/subcategory fields from CW
- PermissionNodes: sales note/product CRUD nodes, subCategories, collectPermissions
- API routes: procurement categories/filters, sales notes/products, opportunity types
- Global events: UDF and member refresh intervals on startup

Tests (414 passing):
- ActivityController, ForecastProductController, OpportunityController unit tests
- UserController cwIdentifier tests
- catalogCategories, companySites, memberCache, procurement module tests
- activityTypes, opportunityTypes, quoteStatuses type tests
- permissionNodes subCategories and getAllPermissionNodes tests
- Updated test setup with redis mock, API method mocks, and builder helpers
2026-03-01 13:19:00 -06:00
HoloPanio 4bec198db6 feat: sales opportunity detail, procurement filters, permission resilience
- Add sales opportunity detail page with tabs (overview, notes, contacts, products, forecasts, activity)
- Add sales note CRUD endpoints (create, update, delete) with server routes
- Add opportunity types, contacts, product sequencing, and refresh API methods
- Add AddProductModal component for catalog browsing
- Update procurement.fetchMany to accept CatalogItemFilters object
- Add procurement.fetchCategories and procurement.fetchFilters endpoints
- Add resilient permission check (no-token returns all-true with __checkFailed)
- Parallelize company detail data fetches for performance
- Remove stale console.log statements across modules
- Add comprehensive unit tests for all new API methods and permission edge cases
2026-03-01 13:08:58 -06:00
HoloPanio 27755d4a00 fix: default permissions to true on API failure to prevent UI hiding
- When the permission check API call fails (timeout, network error, etc.),
  permissions now default to true instead of false
- This prevents UI elements like the WiFi tab from disappearing when the
  permission check has a transient failure
- The API still enforces access server-side, so no security impact
- Added __checkFailed flag to PermissionMap for observability
2026-02-27 18:12:14 -06:00
HoloPanio 0e634c84ff fix: keep login spinner visible until auth callback completes
- Spinner was disappearing when the OAuth popup closed, but the server
  was still waiting for the socket callback (awaitAuthCallback)
- Now the spinner stays until BOTH the popup closes AND the form action
  finishes
- Handle popup-blocked case by resetting loading state immediately
2026-02-27 18:08:27 -06:00
HoloPanio 3b43393e5d fix: add /healthz endpoint to prevent K8s crash loop
- Added dedicated /healthz route returning 200 OK
- Skip API health check in hooks.server.ts for /healthz path
- Updated K8s liveness/readiness probes to use /healthz instead of /login
- The /login probe was returning 503 when the API was unreachable, causing
  Kubernetes to kill and restart the pod in a loop
2026-02-27 18:07:26 -06:00