feat(admin,shop-admin): content/brand management + merchant shop profile (add-content-admin-ui)

This commit is contained in:
Chengdong Zhang
2026-09-23 14:27:00 +08:00
parent 9a749e2551
commit 93e5a05d48
22 changed files with 930 additions and 22 deletions
+20 -2
View File
@@ -2,9 +2,7 @@
## Purpose
The buyer-facing view of a shop: its public profile — identity, contact and service copy — alongside the products it sells, so the store directory, a store's home page and the store card on a product page all read real shops.
## Requirements
### Requirement: Public shop directory
`GET /api/shops` SHALL list the active shops without authentication, and `GET /api/shops/{slug}` SHALL return one shop by slug, answering 404 for an unknown slug or a suspended shop. Each entry SHALL carry the shop's id, slug, bilingual name and its profile: logo and banner URLs, company, region, bilingual address, bilingual notice and after-sale copy, and four score values. A shop with no profile row SHALL still be returned, with the profile fields absent rather than invented.
@@ -34,3 +32,23 @@ A platform admin SHALL set a shop's profile with `PUT /api/admin/shops/{id}/prof
#### Scenario: only platform admins may write
- **WHEN** a shop owner or customer submits a profile
- **THEN** the API refuses the write
### Requirement: Merchant self-service shop profile
A shop owner SHALL set their own shop's profile with `PUT /api/shop/profile`, which upserts the profile row of the shop the caller owns and returns the composed shop profile. The write SHALL require an authenticated user with a shop under the `own_shop` scope and SHALL accept logo and banner URLs, company, region, and bilingual `address`, `notice` and `after_sale` text with the same `{ en, zh }` validation as the platform-admin profile write. Profile scores remain platform-set: merchant-supplied `score_rating`, `score_agreement`, `score_service` or `score_speed` values SHALL NOT be stored. A user without a shop SHALL be refused, and the platform-admin write and public reads SHALL keep their existing behavior.
#### Scenario: merchant upsert round-trips
- **WHEN** a shop owner sets their profile and the storefront reads the shop by slug
- **THEN** the public read returns those values for that shop
#### Scenario: incomplete bilingual text is refused
- **WHEN** a shop owner submits a notice with only `en` text
- **THEN** the request is refused and the stored profile is unchanged
#### Scenario: merchant cannot set scores
- **WHEN** a shop owner submits score values with their profile
- **THEN** the stored scores are unchanged
#### Scenario: a user without a shop is refused
- **WHEN** a signed-in customer sends the merchant profile write
- **THEN** the API refuses the write