While adding Job Opportunity editing to my Candidate Tracker, one optional description produced three different behaviors:
- omit the property to preserve the stored value;
- provide a string to replace it;
- provide
nullto clear it.
The first version mixed undefined and null across the domain, Prisma adapter, application service, and form action. That made clearing a value ambiguous.
The final convention uses string | null for persisted domain entities and optional properties for partial update commands. PostgreSQL NULL, Prisma null, and the domain now use the same absence representation. At the update boundary, omission still means “do not change.”
The broader lesson is that update types describe commands and state transitions. They should distinguish every behavior the application needs instead of merely reusing an entity shape without considering omission.
Top comments (0)