Files
lcbp3/.agent/rules/02-identifier-strategy.md
T
admin 6b89df874e
CI / CD Pipeline / deploy (push) Has been cancelled
CI / CD Pipeline / build (push) Has been cancelled
690401:0823 Update agent rules
2026-04-01 08:23:31 +07:00

19 lines
854 B
Markdown

---
trigger: always_on
---
# 🆔 Identifier Strategy (ADR-019) — CRITICAL
| Context | Type | Notes |
| ---------------- | ------------------------- | ------------------------------------------- |
| Internal / DB FK | `INT AUTO_INCREMENT` | Never exposed in API |
| Public API / URL | `UUIDv7` (MariaDB native) | Stored as BINARY(16), no transformer needed |
| Entity Property | `publicId: string` | Exposed directly in API (no transformation) |
**CRITICAL RULES:**
- **NEVER** use `parseInt`, `Number()`, or `+` on UUID values.
- **NEVER** use `id ?? ''` fallback for identifiers in the frontend.
- Use `publicId` only in frontend and public API responses.
- `INT id` has `@Exclude()` on the backend — it must never appear in API responses.