Currency Model
TheCurrency class represents a currency in the system with its code, full name, and symbol.
Class Structure
Properties
Unique identifier for the currency
Currency code (e.g., USD, EUR, RUB)Validation:
- Length: 3-5 characters
- Format: Uppercase letters only (A-Z)
- Pattern:
[^A-Z](no characters other than uppercase letters) - Automatically converted to uppercase
Full name of the currency (e.g., US Dollar, Euro)Validation:
- Length: 3-60 characters
- Allowed characters: Latin letters (A-Z, a-z), Cyrillic letters (А-Я, а-я, Ё, ё), parentheses, and spaces
- Pattern:
[^A-Za-zА-Яа-яЁё() ](no characters outside the allowed set)
Currency symbol (e.g., $, €, ₽)Validation:
- Length: 1-3 characters
- Pattern:
[ \n](no spaces or newlines allowed)
All currency fields are validated on creation. Empty or null values will result in an error. The validation ensures data integrity and consistent formatting across the system.
CurrencyDTO
Data transfer object used for API responses.TypeScript Definition
Properties
Unique identifier for the currency
Currency code in uppercase format (3-5 characters)
Full name of the currency (3-60 characters)
Currency symbol (1-3 characters)
Example Response
Validation Rules Summary
| Field | Min Length | Max Length | Allowed Characters | Notes |
|---|---|---|---|---|
| Code | 3 | 5 | A-Z (uppercase only) | Auto-converted to uppercase |
| FullName | 3 | 60 | A-Z, a-z, А-Я, а-я, Ё, ё, (), space | Latin and Cyrillic letters, parentheses, spaces |
| Sign | 1 | 3 | Any except space and newline | Currency symbols |