Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jobs/Backend/DotNet.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Mews backend developer task (.NET)

The task is to implement an [ExchangeRateProvider](Task/ExchangeRateProvider.cs) for Czech National Bank. Find data source on their web - part of the task is to find the source of the exchange rate data and a way how to extract it from there.
The task is to implement an [ExchangeRateProvider](Task/ExchangeRateProvider.cs) for Czech National Bank. Find data source on their web - part of the task is to find the source of the exchange rate
data and a way how to extract it from there.

It is up to you to decide which technology (from .NET family) or package to use. Any code design changes/decisions to the provided skeleton are also completely up to you.

Expand Down
3 changes: 2 additions & 1 deletion jobs/Backend/RoR.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Mews backend developer task (Ruby on Rails)

The task is to implement an [ExchangeRateProvider](Task/ExchangeRateProvider.cs) for Czech National Bank. The linked example is written in .NET, but it serves only as a reference. Find the data source on their web - part of the task is to find the source of the exchange rate data and a way how to extract it from there.
The task is to implement an [ExchangeRateProvider](Task/ExchangeRateProvider.cs) for Czech National Bank. The linked example is written in .NET, but it serves only as a reference. Find the data source
on their web - part of the task is to find the source of the exchange rate data and a way how to extract it from there.

It is up to you to decide which Ruby gems to use and whether to implement it as a Rails application. Any code design changes/decisions to the provided skeleton are also completely up to you.

Expand Down
25 changes: 25 additions & 0 deletions jobs/Backend/Task/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
20 changes: 0 additions & 20 deletions jobs/Backend/Task/Currency.cs

This file was deleted.

23 changes: 0 additions & 23 deletions jobs/Backend/Task/ExchangeRate.cs

This file was deleted.

19 changes: 0 additions & 19 deletions jobs/Backend/Task/ExchangeRateProvider.cs

This file was deleted.

8 changes: 0 additions & 8 deletions jobs/Backend/Task/ExchangeRateUpdater.csproj

This file was deleted.

26 changes: 25 additions & 1 deletion jobs/Backend/Task/ExchangeRateUpdater.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeRateUpdater", "ExchangeRateUpdater.csproj", "{7B2695D6-D24C-4460-A58E-A10F08550CE0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeRateUpdater.Api", "src\ExchangeRateUpdater.Api\ExchangeRateUpdater.Api.csproj", "{C514F03C-253E-4099-ABEA-E9A729C81BDC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7104460C-5FFD-4459-A806-6A850353C270}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeRateUpdater.Core", "src\ExchangeRateUpdater.Core\ExchangeRateUpdater.Core.csproj", "{6BF721B1-D50C-457A-A28B-6B50A99DCC07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeRateUpdater.Infrastructure", "src\ExchangeRateUpdater.Infrastructure\ExchangeRateUpdater.Infrastructure.csproj", "{A6E32382-DAA1-4CE2-8552-45E835689D1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeRateUpdater.Tests", "test\ExchangeRateUpdater.Tests\ExchangeRateUpdater.Tests.csproj", "{701317C6-4CF6-4C69-AC91-00F91BCFB46E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +23,22 @@ Global
{7B2695D6-D24C-4460-A58E-A10F08550CE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B2695D6-D24C-4460-A58E-A10F08550CE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B2695D6-D24C-4460-A58E-A10F08550CE0}.Release|Any CPU.Build.0 = Release|Any CPU
{C514F03C-253E-4099-ABEA-E9A729C81BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C514F03C-253E-4099-ABEA-E9A729C81BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C514F03C-253E-4099-ABEA-E9A729C81BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C514F03C-253E-4099-ABEA-E9A729C81BDC}.Release|Any CPU.Build.0 = Release|Any CPU
{6BF721B1-D50C-457A-A28B-6B50A99DCC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BF721B1-D50C-457A-A28B-6B50A99DCC07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BF721B1-D50C-457A-A28B-6B50A99DCC07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BF721B1-D50C-457A-A28B-6B50A99DCC07}.Release|Any CPU.Build.0 = Release|Any CPU
{A6E32382-DAA1-4CE2-8552-45E835689D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6E32382-DAA1-4CE2-8552-45E835689D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6E32382-DAA1-4CE2-8552-45E835689D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6E32382-DAA1-4CE2-8552-45E835689D1A}.Release|Any CPU.Build.0 = Release|Any CPU
{701317C6-4CF6-4C69-AC91-00F91BCFB46E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{701317C6-4CF6-4C69-AC91-00F91BCFB46E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{701317C6-4CF6-4C69-AC91-00F91BCFB46E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{701317C6-4CF6-4C69-AC91-00F91BCFB46E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
43 changes: 0 additions & 43 deletions jobs/Backend/Task/Program.cs

This file was deleted.

160 changes: 160 additions & 0 deletions jobs/Backend/Task/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Exchange Rate Updater API

A .NET API for retrieving currency exchange rates from the Czech National Bank (CNB).
The program for testing the currencies defined in the original repository runs on the startup of `Program.cs` in the **development** environment.

## Features

- Retrieve exchange rates for specific currency pairs
- Support for batch requests of multiple currency pairs
- Date-specific exchange rate data
- Redis caching for improved performance
- Health checks for monitoring API and dependencies
- Containerization with Docker and docker-compose

## Architecture

The solution follows clean architecture principles:

- **Core Layer**: Domain models, interfaces, and business logic
- **Infrastructure Layer**: External integrations (CNB, Redis cache)
- **API Layer**: HTTP endpoints, controllers, and configuration

## Running the API

### Prerequisites

- .NET 9.0 SDK
- Docker & Docker Compose

### Using Docker Compose

```bash
# Start the API and Redis
docker-compose up --build
```

The API will be available at:

- HTTP: http://localhost:8080

### Development Setup

```bash
# Restore packages
dotnet restore

# Run the API
cd src/ExchangeRateUpdater.Api
dotnet run
```

## API Documentation

The API includes Swagger documentation available at the root URL when running in development mode.

### Endpoints

#### Get Exchange Rate

```
GET /api/v1/ExchangeRate?sourceCurrency={sourceCurrency}&targetCurrency={targetCurrency}&date={date}
```

- `sourceCurrency`: Source currency code (e.g., USD)
- `targetCurrency`: Target currency code (e.g., CZK)
- `date` (optional): Date in ISO-8601 format (yyyy-MM-dd)

Example:

```
GET /api/v1/ExchangeRate?sourceCurrency=USD&targetCurrency=CZK&date=2025-05-16
```

Response:

```json
{
"sourceCurrency": "USD",
"targetCurrency": "CZK",
"rate": 22.274,
"date": "2025-05-16",
"datePublished": "2025-05-16"
}
```

#### Batch Exchange Rates

```
POST /api/v1/ExchangeRate/batch
```

Request Body:

```json
{
"date": "2025-05-16",
"currencyPairs": [
"USD/CZK",
"EUR/CZK",
"GBP/CZK"
]
}
```

Response:

```json
{
"date": "2025-05-16",
"datePublished": "2025-05-16",
"rates": [
{
"sourceCurrency": "USD",
"targetCurrency": "CZK",
"rate": 22.274,
"date": "2025-05-16",
"datePublished": "2025-05-16"
},
{
"sourceCurrency": "EUR",
"targetCurrency": "CZK",
"rate": 24.930,
"date": "2025-05-16",
"datePublished": "2025-05-16"
},
{
"sourceCurrency": "GBP",
"targetCurrency": "CZK",
"rate": 29.587,
"date": "2025-05-16",
"datePublished": "2025-05-16"
}
]
}
```

## Health Checks

The API includes health check endpoints:

- `/health/live`: Basic application health
- `/health/ready`: Checks dependencies (Redis, CNB API)

## Notes on CNB Data

- Exchange rates of commonly traded currencies are declared every working day after 2:30 p.m.
- Rates are valid for the current working day and, where relevant, the following Saturday, Sunday, or public holiday.
- CNB API access example: https://www.cnb.cz/en/financial-markets/foreign-exchange-market/central-bank-exchange-rate-fixing/central-bank-exchange-rate-fixing/daily.txt?date=16.05.2025
- Date format for the CNB API is dd.MM.yyyy

## Production Readiness
To be production ready the following needs to be added:

- Use Azure Key Vault or similar for managing secrets in production
- Enable HTTPS with valid SSL certificates
- Configure proper network security groups and firewall rules
- Set up monitoring and alerting (Grafana, SlACK)
- Implement rate limiting for API endpoints
- Add a deployment pipeline (GitHub Actions, Azure DevOps)
- Deploy to a cloud service (Azure App Service, AWS Lambda, Kubernetes)
Loading