- Debian-based api image (bookworm-slim), docker/debian mirrors, prisma binaryTargets for openssl 3.0 - nginx: admin SPA under /admin, TLS via acme.sh (ZeroSSL) + auto-renewal cron, http->https redirect - prisma: add origin_goods.delisted migration, sync missing schema (good_image/tag_font_color/good_tags), fix users.createdAt Timestamptz - api: CORS wildcard reflection, helmet CORP cross-origin, price backfill in persistProductDetail, categoryIcon ancestor fallback, mediaByColor per-color gallery in public goods detail - admin: /admin base path (vite + router) - import-data.mjs: udt_name casting, serial sequence advance fix
39 lines
1.8 KiB
Markdown
39 lines
1.8 KiB
Markdown
# Product External ID Fix Implementation Plan
|
|
|
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
|
|
**Goal:** Make the public goods API return the SDS/InkPOD product ID as `id`, so product-card links target the correct InkPOD detail page.
|
|
|
|
**Architecture:** Keep the local `goods.good_id` as the database identity used by admin and relations. At the public API serialization boundary, map `originGood.sdsGoodId` to the existing response `id` field; the website can continue consuming `product.id` without a second identifier.
|
|
|
|
**Tech Stack:** NestJS, Prisma, Jest, Nuxt/Vue
|
|
|
|
---
|
|
|
|
### Task 1: Lock the public API ID contract
|
|
|
|
**Files:**
|
|
- Modify: `apps/api/src/public/public.service.spec.ts`
|
|
|
|
- [x] Add an assertion that a listed public product has `id` equal to the seeded `OriginGood.sdsGoodId`, not the local `Good.id`.
|
|
- [x] Run the focused API test and confirm it fails because the service currently returns `good.id`.
|
|
|
|
### Task 2: Return the SDS product ID
|
|
|
|
**Files:**
|
|
- Modify: `apps/api/src/public/public.service.ts`
|
|
|
|
- [x] Include `sdsGoodId` in the serializer's `originGood` type.
|
|
- [x] Return `good.originGood.sdsGoodId` as `PublicGoodDto.id`.
|
|
- [x] Run the focused API test and confirm it passes.
|
|
|
|
### Task 3: Verify consumers and document the contract
|
|
|
|
**Files:**
|
|
- Modify: `docs/references/product-center.md`
|
|
- Modify: `docs/references/structs.md`
|
|
|
|
- [x] Document that public product `id` is the SDS/InkPOD external product ID.
|
|
- [x] Run API public-service tests, website tests, and the website build.
|
|
- [ ] Verify the running public endpoint returns `126673` for `200g纯棉T恤KRTM001` when local services are available. (The API was not listening on port 3001 during verification.)
|