SRV-45 — Purchase-based levels, Standard, configurable levels, upkeep and drop
Levels as configured data from qualified purchases, with the migration of the V1 enum.
| Field | Details |
|---|---|
| Task code | SRV-45 |
| Phase | P4 — V2 evolutions |
| Product scope | V2 |
| Status | Planned |
| Start | Thu 25 Feb 2027 |
| Due | Sun 28 Feb 2027 |
| Responsible | Anis — Full-stack developer |
| Co-responsible | — |
| Effort | 2 person-day(s) planned · 5 from scratch · size M |
| Area · app | Server · server |
| Depends on | SRV-44 |
| Unblocks | SRV-46, SRV-47 |
| Milestones | — |
Summary
Levels as configured data from qualified purchases, with the migration of the V1 enum.
Description
Change request 04 (client loyalty document and letter of 6 Nov 2026), not yet accepted or priced by HOCO. Builds LoyaltyLevelDefinition, QualifiedPurchaseEntry and LoyaltyLevelChange, the level period, the AND condition, upgrades after each qualified order, upkeep and drop with notice, and loyalty.objective. Takes over level computation from SRV-30. Migrates the V1 enum LoyaltyLevel on PromotionAudience, the segment criteria and PriceList to level ids.
Subtasks
| # | Subtask | Owner |
|---|---|---|
| 1 | LoyaltyLevelDefinition with admin.loyalty.levels.crud, Standard seeded | Anis |
| 2 | QualifiedPurchaseEntry ledger fed by orders, returns and cancellations | Anis |
| 3 | Migration of LoyaltyLevel to level ids (promotions, segments, price lists) | Anis |
| 4 | Upgrade after each qualified order, LoyaltyLevelChange | Anis |
| 5 | Upkeep, drop, notice job and loyalty.recomputeLevels | Anis |
| 6 | loyalty.objective and loyalty.levels | Anis |
Deliverables
- apps/server/src/modules/loyalty/levels.service.ts
- Prisma migration replacing the enum LoyaltyLevel
Acceptance criteria
- Spending points leaves qualified purchases and level unchanged (LOY-03)
- A level with an order condition needs both conditions (LOY-03)
- A new Diamond level needs no release (LOY-03)
- A drop follows its notice (LOY-20)
- Objective shows 27 500 DA missing in the document's example (LOY-21)
Requirements covered
| Requirement | Title | Release |
|---|---|---|
| LOY-03 | Configurable levels: Standard at sign-up, then levels from qualified purchases over a configurable period | V2 |
| LOY-20 | Level upkeep and drop with notice | V2 |
| LOY-21 | Personal objective: progress to the next level on the home | V2 |
API surface
| Endpoint group | Operations |
|---|---|
| Promotions & loyalty | 41 |
| Loyalty (V2) | 23 |
Test measures
- Migration test on a V1 database copy
- Fake-clock tests of upkeep
Risks
- Thresholds and Diamond vs VIP are open (D-49, D-58)
KPI
- Delivered by Sun 28 Feb 2027 within 2 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.