Commit Graph

21 Commits

Author SHA1 Message Date
saravanakumardb1
9a5e93bf05 feat(nomgap): add social-fasting + meal-log modules (47 tests, 2 Cosmos containers) 2026-02-28 00:37:46 -08:00
saravanakumardb1
5e8f133816 feat(webhooks): add webhook subscriptions module — 15 event types, HMAC signing, retry delivery 2026-02-28 00:27:32 -08:00
saravanakumardb1
b4237acaa2 feat(chronomind): add routines, households, shared-timers modules (88 new tests, 847 total) 2026-02-28 00:05:18 -08:00
saravanakumardb1
c1a1f86cd6 feat(timers): add timer CRUD endpoints for ChronoMind cloud sync (42 new tests, 759 total) 2026-02-27 23:48:31 -08:00
saravanakumardb1
1744bcf63f feat(api): NomGap fasting modules — sessions CRUD + stats, 14 built-in protocols + custom CRUD, body stages + autophagy confidence (47 new tests, 717 total) 2026-02-27 22:32:28 -08:00
saravanakumardb1
ce4c4ff53d feat(telemetry): add telemetry module — ingest, config, query, clusters, policies (34 tests) 2026-02-17 09:06:43 -08:00
saravanakumardb1
2692c918ce feat(waitlist): add pre-launch waitlist module (types, repo, routes)
- Create waitlist/types.ts: WaitlistEntryDoc, Zod schemas for join/status/unsubscribe/admin
- Create waitlist/repository.ts: full CRUD, dedup by emailNormalized, position assignment, stats
- Create waitlist/routes.ts: 5 public endpoints + 7 admin endpoints with role guard
- Add waitlist container to cosmos-init.ts (+ 13 previously missing containers)
- Add dispatchWaitlistJoined webhook to webhooks.ts
- Register waitlistRoutes in server.ts
- Public: join, check status, count, config, unsubscribe
- Admin: list, stats, get, update, delete, batch invite, CSV export
2026-02-16 22:45:14 -08:00
saravanakumardb1
b977e85bc2 feat(platform-service): add profile updates, tokens, and themes modules
Auth:
- PUT /auth/profile — self-service profile update (displayName, phone, bio, avatarUrl)
- ProfileUpdateSchema added to types.ts
- Repository update() expanded to accept profile fields

Tokens module (new):
- GET /tokens — list tokens (admin: all, user: own)
- POST /tokens — create API token (admin only)
- GET /tokens/count — count active tokens
- PATCH /tokens/:id — revoke token (admin only)
- DELETE /tokens/:id — delete token (super_admin only)

Themes module (new):
- GET /themes — list all themes (admin only)
- POST /themes — create theme (admin only)
- GET /themes/active — get active theme (public, no auth)
- GET /themes/:id — get theme by id (admin only)
- PUT /themes/:id — update theme (admin only)
- DELETE /themes/:id — delete theme (admin only)
- POST /themes/:id/activate — set theme as active (admin only)
2026-02-15 17:29:43 -08:00
saravanakumardb1
0c3c109bf1 feat(platform-service): add settings module with device overrides
- Added settings module (types, repository, routes)
- Endpoints: GET/PUT /settings, GET/PUT/DELETE /settings/device/:deviceId
- Enforced userId from JWT and productId request scoping
- Added settings Cosmos container registration and route registration in server
- Added module tests for settings schemas and route export
- Verified: tsc --noEmit clean, 20 test files / 183 tests passing
2026-02-15 14:57:20 -08:00
saravanakumardb1
c0830e3dec refactor(platform-service): remove BILLING_INTERNAL_KEY guard from server.ts
- Billing routes (subscriptions, usage, plans, licenses) now registered directly
- No more X-Internal-Key header check — JWT-based productId auth is sufficient
- BILLING_INTERNAL_KEY removed from config schema and AKV secret resolution
- 166 tests pass, tsc clean
2026-02-15 14:30:30 -08:00
saravanakumardb1
465d429e09 feat(platform-service): add Fastify onRequest hook to parse JWT → req.jwtPayload
- Best-effort JWT parsing on every request (non-blocking for unauthenticated routes)
- Attaches parsed payload to req.jwtPayload for downstream use by getRequestProductId()
- Invalid/expired tokens silently ignored — auth-required routes handle their own validation
2026-02-15 14:15:17 -08:00
saravanakumardb1
755c16dbfb feat(platform-service): add products module (types, repository, cache, routes)
- New products container in Cosmos DB (partition key: /id)
- ProductDoc: displayName, licensePrefix, deviceLimits, trialDays, status
- In-memory cache loaded on startup via loadProductCache()
- CRUD routes: GET/POST /products, GET/PUT /products/:id
- Cache refreshed after admin writes (create/update)
- Registered before all other modules in server.ts
2026-02-15 14:13:03 -08:00
17c41e8441 feat(platform-service): add memory-items API backed by Cosmos 2026-02-15 03:20:09 -08:00
saravanakumardb1
81999dcbb3 feat(services): wire AKV secret resolution in platform-service and extraction-service startup 2026-02-14 22:18:01 -08:00
saravanakumardb1
29fc8124e4 refactor: merge tracker-service into platform-service
Phase 3 of service consolidation (5→2 services).

Moved modules:
- items (16 tests)
- comments (6 tests)
- votes (5 tests)
- public (16 tests) — rate-limited, no auth required

Changes:
- Copied 4 modules from tracker-service
- Added DEFAULT_PRODUCT_ID alias in product-config.ts (Gap 1)
- Created src/lib/auth.ts re-exporting extractAuth from @bytelyst/auth (Gap 2)
- Added @bytelyst/auth and @fastify/rate-limit to package.json (Gap 2)
- Registered itemRoutes, commentRoutes, voteRoutes, publicRoutes in server.ts
- Public routes at top level (no auth scope)
- Removed tracker-service directory

Tests: 158 passing (115 + 43 from tracker = 158) 
Build: clean 

Service consolidation Phases 1-3 complete:
- growth-service: merged 
- billing-service: merged 
- tracker-service: merged 
Remaining: 2 services (platform-service + extraction-service)
2026-02-14 21:34:21 -08:00
saravanakumardb1
f13c676139 refactor: merge billing-service into platform-service
Phase 2 of service consolidation (5→2 services).

Moved modules:
- subscriptions (9 tests)
- usage (7 tests)
- plans (9 tests)
- licenses (7 tests)
- stripe (0 tests — webhook signature verified at runtime)

Changes:
- Copied 5 modules + stripe.ts lib from billing-service
- Added billing env vars to config schema (Stripe, internal key, etc.)
- Scoped billing routes with internal key auth guard (Gap 3)
  - When BILLING_INTERNAL_KEY is set, billing routes require x-internal-key header
  - When unset, billing routes are open (dev mode)
  - Stripe routes always outside scope (own webhook signature check)
- Removed billing-service directory

Tests: 115 passing (83 + 32 from billing = 115) 
Build: clean 
2026-02-14 21:31:04 -08:00
saravanakumardb1
05008ee04f refactor: merge growth-service into platform-service
Phase 1 of service consolidation (5→2 services).

Moved modules:
- invitations (12 tests)
- referrals (9 tests)
- promos (7 tests)

Changes:
- Copied 3 modules + webhooks.ts lib from growth-service
- Added stripe dep to platform-service package.json
- Added webhook env vars to config schema
- Registered invitationRoutes, referralRoutes, promoRoutes in server.ts
- Removed growth-service directory

Tests: 83 passing (was 55 + 28 from growth = 83) 
Build: clean 
2026-02-14 21:27:44 -08:00
95b45a9fd3 fix(cosmos): init containers on startup for local compose 2026-02-14 20:57:17 -08:00
saravanakumardb1
63c08dbb0a refactor(services): integrate @bytelyst/fastify-core into all 4 services
Replaced duplicated server setup code with createServiceApp() factory:
- platform-service: 91 → 39 lines
- billing-service: 105 → 51 lines (keeps service-specific internal key auth)
- growth-service: 83 → 33 lines
- tracker-service: 88 → 36 lines

Enhanced fastify-core with optional Swagger + Prometheus metrics support.
Total reduction: ~208 lines of duplicated boilerplate eliminated.
All 246 tests pass.
2026-02-12 22:53:22 -08:00
saravanakumardb1
90b9cf93d8 fix(common): configure ESLint 9 and fix lint issues
- Added @eslint/js dependency
- Updated eslint.config.js for ESLint 9 compatibility
- Added required globals (crypto, localStorage, React, etc.)
- Fixed unused imports and variables
- Disabled sort-imports temporarily
- Formatted all files with Prettier
2026-02-12 16:37:30 -08:00
saravanakumardb1
e1ab956ac3 feat(services): add platform-service (auth, audit, flags, notifications, blob)
- Copied as-is from learning_voice_ai_agent/services/platform-service
- 55 tests passing (vitest)
- Fastify 5 + Cosmos DB + jose + bcryptjs + Zod
- Modules: auth, audit, flags, notifications, blob, ratelimit
- Port 4003
2026-02-12 11:39:00 -08:00