FruitBankHybridApp/docs/CONVENTIONS.md

41 lines
2.1 KiB
Markdown
Raw 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.

# Conventions
## Naming
- **fb prefix** on database tables: `fbPallet`, `fbShipping`, `fbShippingItem`, etc.
- **Dto suffix** for DTOs wrapping nopCommerce entities: `OrderDto`, `OrderItemDto`, `ProductDto`.
- **XxxItemPallet** for measurement records: `ShippingItemPallet`, `OrderItemPallet`, `StockTakingItemPallet`.
- **Grid prefix** for Blazor grid components: `GridPartnerBase`, `GridShippingBase`, etc.
- **SignalRTags** constants use numeric ranges by domain (see `FruitBank.Common/SignalRs/`).
## Patterns
- **MeasuringItemPalletBase** as abstract base for all three measurement hierarchies.
- **GenericAttributes** for extending nopCommerce entities with custom data (IsMeasurable, Tare, AverageWeight).
- **Composition interfaces** for measurement traits: IMeasuringValues = IMeasuringWeights + IMeasuringQuantity.
- **DevExpress DxGrid** with `AcSignalRDataSource` for real-time grid data.
- **MgGridBase** for grid layout persistence via localStorage.
- **FruitBankSignalRClient** as single hub client for all server communication.
- **DatabaseClient** for client-side caching with ConcurrentDictionary tables.
## Code Reuse
- Before writing new code, search the codebase for existing implementations.
- If a method does most of what you need, extract the shared part into a smaller reusable method rather than copying and modifying.
- Prefer composing existing helpers over creating parallel implementations.
## Critical Rules
- **MeasuringStatus.Finnished** — intentional legacy typo. Do NOT fix.
- **Shipping = INBOUND, Order = OUTBOUND** — never confuse directions.
- **Pallet = measurement record** — always created, even for non-measurable products.
- **NetWeight is calculated, never stored** — GrossWeight PalletWeight (TrayQuantity × TareWeight).
- **DLL references** to AyCode projects are intentional — do not convert to ProjectReference.
- Do not suggest removal/rollback as a solution — find a fix.
## UI (Hungarian Locale)
- Status labels and UI text are in Hungarian.
- MeasuringStatus display: "Nincs elkezdve", "Elkezdve", "Kész", "Auditált".
- Date format follows Hungarian conventions.