# Backend implementation tasks Status date: 2026-07-23 ## Phase 1 - isolated backend baseline - [x] Create `E:\workspace\server\saas-voc-server` as an independent Git repository. - [x] Keep `moshengqi-server` and `future-server` read-only. - [x] Add strict environment validation without credential fallbacks. - [x] Add pooled PostgreSQL access and an idempotent migration runner. - [x] Add an independent Parse Server application configuration. - [x] Add the initial domestic VOC schema, constraints, foreign keys, and indexes. - [x] Seed the `demashi` workspace and JD source metadata. - [x] Add health, sync, job-status, and snapshot endpoints. - [x] Add Fmode timeout/retry/authentication behavior behind a server-only client. - [x] Add unit tests and compile under strict TypeScript settings. - [ ] Run migrations against a newly provisioned PostgreSQL database. - [ ] Smoke-test the HTTP service under the supported Node 22 runtime. ## Phase 2 - case-data persistence - [x] Add a batch importer for the normalized Demashi dataset. - [ ] UPSERT 2,817 operating products, 38 relation stubs, and 9,717 daily metric rows in bounded batches. - [ ] UPSERT 40 competitor relations with deterministic relation keys. - [ ] Verify snapshot totals against `demashi-summary.json`. - [x] Switch `DomesticDatasetService` between static case mode and backend API mode. - [ ] Run the existing 29-route desktop/mobile audit against API mode. ## Phase 3 - real JD source contract - [x] Verify the existing Fmode gateway health endpoint over public TLS (HTTP 200 on 2026-07-23). - [ ] Complete one quota-controlled live JD request through the existing Fmode gateway after a dedicated `FMODE_API_KEY` is available. - [x] Confirm the catalog JD product-detail path and required `itemId` parameter. - [x] Confirm the catalog JD review path and optional `page` parameter. - [ ] Confirm the live response envelope, pagination values, and any async task/status flow. - [ ] Save sanitized response fixtures without credentials or personal data. - [x] Implement JD product and review adapters against company-gateway contract fixtures. - [x] Process queued jobs with partial-failure events and bounded retries. - [x] Implement idempotent product/review UPSERT and truthful job progress updates. - [ ] Verify source UPSERT and snapshot totals against the provisioned PostgreSQL database. ## Phase 4 - deployable closure - [ ] Provision a dedicated PostgreSQL database and least-privilege runtime role. - [ ] Provision independent Parse application credentials. - [ ] Put TLS and same-origin reverse proxying in front of `/parse` and `/api/domestic-voc`. - [ ] Add authentication/authorization before enabling the frontend `AuthGuard`. - [ ] Add backup, restore, retention, and failed-job replay procedures. - [ ] Resolve or formally accept remaining moderate Parse transitive advisories. - [ ] Complete end-to-end acceptance with Demashi product detail and real review evidence. ## Explicitly deferred - Multi-platform adapters beyond JD. - Multi-tenant billing and complex role management. - Scheduled full-catalog crawling. - AI reports, sentiment, pain points, or recommendations without review evidence. - Any reuse of the cross-border production database or credentials.