Refine admin review and product image handling
This commit is contained in:
154
HANDOFF.md
154
HANDOFF.md
@ -14,6 +14,160 @@ The latest build was verified successfully with:
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Current Local Changes After `7e6446b`
|
||||
|
||||
These are the important local changes made after the last recorded commit. The latest local build was verified successfully with `npm run build`, and the production local server was restarted on `http://localhost:3000`.
|
||||
|
||||
### Admin review compare flow
|
||||
|
||||
File:
|
||||
- `src/app/admin/review/[productId]/page.tsx`
|
||||
|
||||
Behavior:
|
||||
- Product update review now uses the compare API as the source of truth:
|
||||
- frontend proxy: `GET /api/admin/review/{productId}/compare`
|
||||
- backend: `GET /api/v1.0/product/compare/{productId}`
|
||||
- The compare payload is parsed from rows like:
|
||||
- `productImages[id=...].image`
|
||||
- `productFiles[id=...].fileId`
|
||||
- `productModels[sku=...].price`
|
||||
- `categoryInformations[paramName=Design].paramValue`
|
||||
- `productFeatures[3]`
|
||||
- nested objects such as `complianceInformation.safetyWarning`
|
||||
- The page reconstructs:
|
||||
- `oldProduct` from `oldValue`
|
||||
- `newProduct` from `newValue`
|
||||
- The compare layout is now section-paired, not product-paired:
|
||||
- `Gambar Produk (Diajukan)`
|
||||
- `Gambar Produk (Live Saat Ini)`
|
||||
- `Detail Produk (Diajukan)`
|
||||
- `Detail Produk (Live Saat Ini)`
|
||||
- and so on for features, keywords, info, files, models, compliance, warranty
|
||||
- Empty section pairs are hidden. If both proposed and live sections have no displayable content, nothing is rendered.
|
||||
- `Status` is not shown in the compare `Detail Produk` section and no longer marks the section as updated.
|
||||
- Compare image thumbnails are rendered as small square thumbnails with `object-contain`, so images are visible in full instead of cropped into wide banners.
|
||||
- Approve/reject for update reviews uses the resolved review/action id from compare, when available.
|
||||
|
||||
Reference test data:
|
||||
- `/Users/wirabasalamah/Downloads/json compare.txt`
|
||||
- Example compare API:
|
||||
- `/api/v1.0/product/compare/ba70a8e3-2342-4cd3-a7c7-a0f1b58689ab`
|
||||
|
||||
### Image URL handling
|
||||
|
||||
Files:
|
||||
- `src/lib/image-url.ts`
|
||||
- `src/components/product-variant-showcase.tsx`
|
||||
- `src/app/(dashboard)/products/[productId]/detail/page.tsx`
|
||||
- `src/app/admin/products/[productId]/page.tsx`
|
||||
- `src/app/admin/review/[productId]/page.tsx`
|
||||
- `src/app/admin/review/page.tsx`
|
||||
- `src/app/admin/news/new/page.tsx`
|
||||
- `src/app/admin/news/[newsId]/edit/page.tsx`
|
||||
- `src/app/admin/places/PlaceForm.tsx`
|
||||
|
||||
Behavior:
|
||||
- Added shared image URL helper:
|
||||
- if backend already provides an image URL, use it as-is
|
||||
- otherwise build a fallback URL from `imageId`
|
||||
- default fallback uses `/api/v1.0/file/image/tmp/{imageId}`
|
||||
- Seller/admin product details and admin review now use backend `image` fields before building URLs.
|
||||
- Product variant showcase now supports `image` on product images and model images.
|
||||
|
||||
### Product create/edit thumbnail persistence
|
||||
|
||||
Files:
|
||||
- `src/app/(dashboard)/products/new/details/page.tsx`
|
||||
- `src/app/(dashboard)/products/new/pricing/page.tsx`
|
||||
- `src/app/(dashboard)/products/new/review/page.tsx`
|
||||
- `src/app/api/file/image/[...path]/route.ts`
|
||||
|
||||
Behavior:
|
||||
- Added local API proxy for images:
|
||||
- `GET /api/file/image/{path}`
|
||||
- forwards to backend `/api/v1.0/file/image/{path}` with auth headers
|
||||
- Create product step 2 and step 3 reload thumbnails from saved file ids when navigating forward/back.
|
||||
- Create product final review shows real thumbnails for visual identity and model images.
|
||||
- Review page was made full width and now displays model image and measurement details more completely.
|
||||
|
||||
### Product create submit debug logging
|
||||
|
||||
File:
|
||||
- `src/app/api/products/create/route.ts`
|
||||
|
||||
Behavior:
|
||||
- When `DEBUG_BACKEND_PROXY=true`, create product submit writes `product-create-submit-log.json`.
|
||||
- The log captures:
|
||||
- local endpoint
|
||||
- backend endpoint
|
||||
- redacted headers
|
||||
- full request payload
|
||||
- backend response
|
||||
|
||||
Current known finding from latest capture:
|
||||
- Payload sent top-level `imageId` and separate `productImages`.
|
||||
- Backend review detail returned top-level `imageId` from `productImages[0]`, not from request top-level `imageId`.
|
||||
- Payload sent `productFiles`, but review detail returned `productFiles: []` in the checked response.
|
||||
|
||||
### Dashboard seller metrics
|
||||
|
||||
File:
|
||||
- `src/app/api/dashboard/seller/route.ts`
|
||||
|
||||
Behavior:
|
||||
- Fixed parsing of scalar metrics from backend payloads where `data` is an object like `{ total: 96 }`.
|
||||
- Verified for Pendopo account that dashboard total products can resolve to non-zero.
|
||||
|
||||
### Admin product list/detail
|
||||
|
||||
Files:
|
||||
- `src/app/admin/products/page.tsx`
|
||||
- `src/app/admin/products/[productId]/page.tsx`
|
||||
- `src/app/api/admin/products/route.ts`
|
||||
|
||||
Behavior:
|
||||
- Admin product list now renders product thumbnails in `All Product` and `Deleted` tabs.
|
||||
- Thumbnail uses the shared image URL helper.
|
||||
- Admin product detail now resolves main category by looking up categories/subcategories when backend omits `subCategory.category.name`.
|
||||
- Admin All Product endpoint was tested with:
|
||||
- `GET /api/v1.0/admin/product?page=1&size=20`
|
||||
- Backend returned:
|
||||
- HTTP `400`
|
||||
- body `{"responseCode":"000001","data":null,"responseDesc":"Bad Request"}`
|
||||
- Current proxy behavior:
|
||||
- tries `/api/v1.0/admin/product`
|
||||
- if non-deleted tab and the admin endpoint fails, falls back to `/api/v1.0/product`
|
||||
- Deleted endpoint remains:
|
||||
- `GET /api/v1.0/admin/deleted/product?page={page}&size={size}`
|
||||
- Server log showed request reached backend with admin token and failed in about 3 ms, suggesting request validation/contract mismatch rather than auth or DB latency.
|
||||
|
||||
### Seller profile save flow
|
||||
|
||||
Files:
|
||||
- `src/app/(dashboard)/settings/page.tsx`
|
||||
- `src/app/api/seller/profile/route.ts`
|
||||
|
||||
Behavior:
|
||||
- Seller profile edit saves via:
|
||||
- frontend: `PUT /api/seller/profile`
|
||||
- backend: `PUT /api/v1.0/seller/store`
|
||||
- Payload:
|
||||
- `storeName`
|
||||
- `storeBiography`
|
||||
- optional `imageId` when seller avatar was uploaded
|
||||
- optional `storeImageId` when store image was uploaded
|
||||
|
||||
Example payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"storeName": "...",
|
||||
"storeBiography": "...",
|
||||
"imageId": "optional-file-id",
|
||||
"storeImageId": "optional-file-id"
|
||||
}
|
||||
```
|
||||
|
||||
## Recent Commits
|
||||
|
||||
- `7e6446b` `Refine seller onboarding and product review flows`
|
||||
|
||||
Reference in New Issue
Block a user