Skip to main content

Currency Model

The Currency class represents a currency in the system with its code, full name, and symbol.

Class Structure

public class Currency
{
    public int Id { get; }
    public string Code { get; }
    public string FullName { get; }
    public string Sign { get; }
}

Properties

Id
integer
required
Unique identifier for the currency
Code
string
required
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
FullName
string
required
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)
Sign
string
required
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

interface CurrencyDTO {
  ID: number;
  Code: string;
  FullName: string;
  Sign: string;
}

Properties

ID
integer
required
Unique identifier for the currency
Code
string
required
Currency code in uppercase format (3-5 characters)
FullName
string
required
Full name of the currency (3-60 characters)
Sign
string
required
Currency symbol (1-3 characters)

Example Response

{
  "ID": 1,
  "Code": "USD",
  "FullName": "US Dollar",
  "Sign": "$"
}

Validation Rules Summary

FieldMin LengthMax LengthAllowed CharactersNotes
Code35A-Z (uppercase only)Auto-converted to uppercase
FullName360A-Z, a-z, А-Я, а-я, Ё, ё, (), spaceLatin and Cyrillic letters, parentheses, spaces
Sign13Any except space and newlineCurrency symbols

Additional Examples

USD Currency

{
  "ID": 1,
  "Code": "USD",
  "FullName": "US Dollar",
  "Sign": "$"
}

EUR Currency

{
  "ID": 2,
  "Code": "EUR",
  "FullName": "Euro",
  "Sign": "€"
}

RUB Currency

{
  "ID": 3,
  "Code": "RUB",
  "FullName": "Российский рубль",
  "Sign": "₽"
}

Build docs developers (and LLMs) love