SRV-39 — Smart notifications — contract & schema (groups, actions, flash sales, complementary products)
Additive contract and Prisma changes for document 03: NotificationGroup and AnnouncementKind enums, group and action on notifications and templates, per-group preferences, Promotion.isFlashSale, ProductComplement, Product.announceAsNew/publishedAt, announcement targets, query and response fields.
| Field | Details |
|---|---|
| Task code | SRV-39 |
| Phase | P1 — V1 build & integration |
| Product scope | V1 |
| Status | Done (Mon 19 Oct 2026) |
| Start | Mon 19 Oct 2026 |
| Due | Mon 19 Oct 2026 |
| Responsible | Anis — Full-stack developer |
| Co-responsible | — |
| Effort | 0.5 person-day(s) planned · 2 from scratch · size XS |
| Area · app | Server · server |
| Depends on | SRV-08, SRV-11, SRV-19 |
| Unblocks | SRV-40, MRA-11 |
| Milestones | — |
Summary
Additive contract and Prisma changes for document 03: NotificationGroup and AnnouncementKind enums, group and action on notifications and templates, per-group preferences, Promotion.isFlashSale, ProductComplement, Product.announceAsNew/publishedAt, announcement targets, query and response fields.
Description
Implements the data and API impact table of /docs/srs/smart-notifications#data-api so that the mobile and web work (MRA-11, WEB-06) can start against the mock server while the triggers are built (SRV-40). Every change is additive: no operation is renamed, no field removed, no op id added to endpoints.json. Done early in the lane, right after the promotions module (SRV-19), because Imad needs the contract before his November reseller-app tasks end.
Subtasks
| # | Subtask | Owner |
|---|---|---|
| 1 | Prisma: enums NotificationGroup and AnnouncementKind; Notification.group/actionLabel/actionRoute with index (userId, group, createdAt); NotificationTemplate.group/actionLabel; NotificationRule.priority/mergeWindowHours; NotificationPreference.group | Anis |
| 2 | Prisma: Promotion.isFlashSale with the 2 h–48 h validation (FLASH_SALE_DURATION) and the exclusivity with isDailyOffer; ProductComplement (unique pair, max 5, no self-reference); Product.announceAsNew and publishedAt; Announcement.kind, group, productId, promotionId, categoryId, brandId, fileId, actionLabel | Anis |
| 3 | Contracts: notifications.list items group and action { label, deepLink }, ?group=; notifications.unreadCount byGroup; preferences per group (422 PREFERENCE_NOT_EDITABLE on URGENT) | Anis |
| 4 | Contracts: promotions.list isFlashSale and ?tab=promotions|flash; catalog.home flashSales[]; admin product payload complementProductIds[], announceAsNew; admin.announcements kind/target/actionLabel and the push / inbox-only split in the send response | Anis |
| 5 | Push payload: data.actionLabel, data.group; settings keys smart.* and notifications.promotionalWeeklyCap in the settings catalogue with defaults | Anis |
| 6 | Seed: group and action label for every existing reseller template (defaults of /docs/srs/smart-notifications#actions-existing); OpenAPI export and mock examples | Anis |
Deliverables
- packages/db/prisma/schema/{support,promotions,catalog,enums}.prisma + migration
- packages/contracts/src/{notifications,promotions,catalog}.ts and admin counterparts
- Regenerated OpenAPI document and mock server examples
Acceptance criteria
- The migration applies on a copy of staging data without loss; existing notifications read with group null and action null
- OpenAPI shows the new fields; the Dart client regenerates without breaking MRA-08 code
- A flash sale of 72 h is refused with FLASH_SALE_DURATION; a ProductComplement to itself is refused
Requirements covered
| Requirement | Title | Release |
|---|---|---|
| NOT-09 | Notification groups and the Notification Centre on the reseller home (Urgent, Promotions, Nouveautés, Points et niveaux, Academy, Suggestions) | V1 |
| NOT-10 | An action button (label and deep link) on every reseller notification | V1 |
| NOT-15 | Complementary product suggestions from pairs configured on the product | V1 |
| NOT-16 | Commercial push: HOCO picks a product and an audience | V1 |
| NOT-17 | Anti-fatigue rules: promotional push caps, priority, merge, quiet hours, opt-out per group | V1 |
| PRM-07 | Flash sales (2 h to 48 h) with countdown and the promotion tabs Promotions / Flash Sales | V1 |
API surface
| Endpoint group | Operations |
|---|---|
| Notifications & announcements | 10 |
| Promotions, banners & packs | 5 |
| Catalog & favorites | 12 |
| Promotions & loyalty | 10 |
| Support & communication | 10 |
| Catalog & pricing | 19 |
Test measures
- Contract snapshot tests of notifications.list and promotions.list
- Migration test on the seed database
Risks
- Late renames break Imad's generated client — freeze the field names on the day of the export and announce them
KPI
- Delivered by Mon 19 Oct 2026 within 0.5 person-day(s).
- Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
- Zero open critical defects, permission gaps or data-integrity regressions at sign-off.
Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.
SRV-16 — Orders module — lifecycle, assisted orders, history, documents
The 11-status state machine (no automatic confirmation — every order is confirmed in the back-office), controls, refusal and controlled modification, assisted orders and confirmations, first-order attribution, cancellation with automatic restock, invoice and delivery-note PDFs.
SRV-21 — Field operations module — objectives, tours, visits, reports
Objectives, tour planning and lifecycle, visits with GPS check-in tolerance, checklists, photos, structured reports that create follow-ups, location pings, closing summary/KPIs, recommended visit order.