Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Avoid exposing a column under a name that conflicts with another field
Don't alias a database column to a DTO property name that collides with the real meaning of another column; it confuses consumers and blocks exposing the original column later.
Bad example
| 1 | // exposes `value` column as `averageListPrice` while a real `value` also exists |
| 2 | SELECT value AS averageListPrice, value FROM ... |
Explanation (EN)
An alias that suggests an average while carrying a raw value misleads downstream calculations.
Objašnjenje (HR)
Good example
| 1 | // give the derived field its own unambiguous source/name |
| 2 | SELECT AVG(list_price) AS averageListPrice FROM ... |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
When mapping a query result into a DTO, confirm that every alias describes the source value or calculation and preserves the public contract.
Exceptions / Tradeoffs (EN)
A compatibility alias may be necessary for an established API, but document the mapping and plan any rename as a contract change.