Files
dyolink/.cursor/rules/tooth-shade.mdc
2026-11-30 12:44:11 +03:30

19 lines
2.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: Case-level tooth shade (VITA codes) — storage, edit gates, surfaces, voice
globs: backend/src/modules/tooth-shade-catalog/**,backend/src/modules/cases/cases.service.ts,backend/src/modules/treatments/treatments.service.ts,backend/src/modules/voice/**,frontend/src/components/ui/shared/ToothShadeGuide.tsx,frontend/src/components/ui/treatment/TreatmentDetailsEditor.tsx,frontend/src/components/ui/treatment/TreatmentWorkspace.tsx,frontend/src/components/ui/lab/Case*.tsx,frontend/src/components/treatment/voice*.ts,frontend/src/components/lab/voiceLine.ts
alwaysApply: false
---
# Tooth shade
- **One optional shade per lab case**, not per tooth: `LabCase.toothShadeCode` → `ToothShade.code` (nullable FK). Codes: `0M1–0M3, A1–A4 (+A3.5), B1–B4, C1–C4, D2–D4`. Lab-dependent work only.
- **Null is normal.** Historical shades stay in comments/notes; never backfill. Every surface must tolerate `null`.
- **Validate** with `ToothShadeCatalogService.normalize` (canonicalizes `a 3,5` → `A3.5`, `OM1` → `0M1`; unknown → `TOOTH_SHADE_INVALID`). Inactive codes stay valid on existing cases; the picker lists active ones.
- **Edit gates** (`TOOTH_SHADE_LOCKED` on a real change only — autosave resends unchanged values, which must stay a no-op):
- Clinic (Treatment provider): unsent, or sent until any step in the outsource tree is completed.
- Lab: `LAB_INTERNAL` drafts via draft autosave; started via `PATCH /cases/:id/tooth-shade` until a current-round step in the tree is completed. Needs `TAB_CASES_EDIT`.
- Received `CLINIC_DISPATCH` and `LAB_OUTSOURCE` cases are read-only for the lab. Outsource copies the parent shade, and later parent edits update the children.
- **Full guide** (`ToothShadeGuide`, LTR tab order in every locale): Treatment editor under the type row for lab-dependent details, Cases create panel, and the case detail header (hidden there when read-only and empty). **Text only** elsewhere: Tasks grouped header (also the share page), Case Sheet PDF (`—` when empty).
- **Voice:** `toothShadeCode` field — never in `comment`. Lands only on a lab-dependent detail (or a lab case line).
- Exocad `.dentalProject` export maps the case shade to per-tooth `ToothShade`: classical codes as `VCL:<code>`, bleach `0M1`–`0M3` as `V3DM:<code>` (no incisal/gingival zones).