43 — Shop Model Extension for Testimonials (Blueprint §5.1)
Cursor-ready plan for adding testimonial-specific fields to Shop, migration safety, defaults, and ownership boundaries.
43 — Shop Model Extension for Testimonials (Blueprint §5.1)
Section titled “43 — Shop Model Extension for Testimonials (Blueprint §5.1)”Source: 02-Implementation-Blueprint.md — §5.1 Extend Shop model.
This document is a build spec only. No code changes are implied until a task references this file.
Related: 04 (cleanup/what to keep), 20 (database sequencing), 12 (moderation settings), 05 (widget settings), 08 (consent/privacy).
0) Goal (one sentence)
Section titled “0) Goal (one sentence)”Add testimonial feature defaults at the tenant root (Shop) so all screens and pipelines can read a single authoritative configuration baseline.
1) Blueprint field set
Section titled “1) Blueprint field set”Blueprint §5.1 proposes adding:
testimonialEnabled Boolean @default(true) @map("testimonial_enabled")testimonialWidgetLayout String? @default("carousel") @map("testimonial_widget_layout")testimonialPrimaryColor String? @map("testimonial_primary_color")testimonialAutoApprovePhotos Boolean @default(false) @map("testimonial_auto_approve_photos")testimonialConsentVersion String? @map("testimonial_consent_version")
These should be added without breaking existing shops.
2) Scope boundaries
Section titled “2) Scope boundaries”In scope
Section titled “In scope”- Shop column additions and defaults
- read/write ownership boundaries per field
- migration safety and backfill strategy
Out of scope
Section titled “Out of scope”- adding all future settings fields in one step (can be phased)
- deep settings UI implementation (covered in screen-specific plans)
3) Field ownership map
Section titled “3) Field ownership map”| Field | Primary owners | Used by |
|---|---|---|
testimonialEnabled | Global settings/admin | public submission route gate, widget API gate |
testimonialWidgetLayout | Widget settings screen | storefront widget default render mode |
testimonialPrimaryColor | Widget settings screen | storefront/theme styling |
testimonialAutoApprovePhotos | Moderation settings screen | submit/moderation rule engine |
testimonialConsentVersion | Settings/moderation policy config | submit API consent snapshot |
Explicit ownership avoids conflicting writes across screens.
4) Defaults and fallback behavior
Section titled “4) Defaults and fallback behavior”Recommended defaults:
testimonialEnabled=truetestimonialWidgetLayout='carousel'testimonialPrimaryColornullable; UI fallback to brand defaulttestimonialAutoApprovePhotos=falsetestimonialConsentVersionnullable until merchant sets policy
Runtime fallback policy:
- if consent version null, submit API can still require consent and store a generated fallback version string (e.g.
v1-default) only if product approves this behavior.
5) Migration strategy
Section titled “5) Migration strategy”5.1 Phase 1 (safe add)
Section titled “5.1 Phase 1 (safe add)”- Add columns as nullable/defaulted exactly as blueprint suggests.
- No immediate backfill required beyond DB defaults.
5.2 Phase 2 (optional hardening)
Section titled “5.2 Phase 2 (optional hardening)”- Backfill missing consent version for active shops.
- Tighten constraints if product requires non-null values later.
Keep migration reversible and low-risk for existing installs.
6) Runtime usage contracts
Section titled “6) Runtime usage contracts”6.1 testimonialEnabled
Section titled “6.1 testimonialEnabled”When false:
- public submission routes return disabled state
- widget API returns empty or disabled response
- campaign send worker should skip new sends (product choice; recommended)
6.2 testimonialAutoApprovePhotos
Section titled “6.2 testimonialAutoApprovePhotos”Read during submit/moderation rule evaluation:
- photo submissions can auto-transition to approved when true.
6.3 testimonialConsentVersion
Section titled “6.3 testimonialConsentVersion”Snapshot copied into each submission at submit time; old submissions are immutable.
7) Validation rules for write paths
Section titled “7) Validation rules for write paths”testimonialWidgetLayoutmust be in allowed list (carousel,grid,masonry, etc. per screen design)testimonialPrimaryColormust be valid color token/hex formattestimonialConsentVersionmax length and safe characters
Server-side validation required even if UI validates.
8) Cross-plan alignment
Section titled “8) Cross-plan alignment”This Shop extension should be treated as the base layer for:
05widget defaults12moderation defaults06consent snapshot behavior08privacy/compliance handling
Avoid duplicating these values in separate singleton tables unless a later refactor is intentional.
9) Acceptance criteria
Section titled “9) Acceptance criteria”- New columns appear in schema/migration with correct defaults and maps.
- Existing shops load without runtime errors.
- Settings writes correctly persist and are readable by dependent routes.
- Submit/moderation/widget paths honor shop-level flags.
10) Suggested implementation order (for Cursor)
Section titled “10) Suggested implementation order (for Cursor)”- Add Shop columns in Prisma schema + migration.
- Update server types/selects that read
Shop. - Wire reads into dependent modules (submit, moderation, widget API).
- Add/update admin settings controls.
- Add tests for enabled/disabled and auto-approve/consent version behavior.
11) References
Section titled “11) References”02-Implementation-Blueprint.md— §5.104-Delete All Existing Code and DB Tables.md20-database-design-and-migrations-blueprint-section-5.md05-storefront-widgets-and-read-api.md12-moderation-settings-screen-9.md08-security-compliance-and-privacy.md
12) Note on numbering
Section titled “12) Note on numbering”This folder already includes 05 through 42 plans. This file is 43-....