Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sararasoulian/tax-calculator
🚗 An application for calculating congestion tax for vehicles
https://github.com/sararasoulian/tax-calculator
clean-architecture clean-code docker docker-compose dot-net-8 entity-framework-core integration-testing postgresql restful-api
Last synced: 8 days ago
JSON representation
🚗 An application for calculating congestion tax for vehicles
- Host: GitHub
- URL: https://github.com/sararasoulian/tax-calculator
- Owner: SaraRasoulian
- License: mit
- Created: 2024-05-20T13:12:29.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T10:47:54.000Z (8 months ago)
- Last Synced: 2024-11-14T12:51:18.127Z (2 months ago)
- Topics: clean-architecture, clean-code, docker, docker-compose, dot-net-8, entity-framework-core, integration-testing, postgresql, restful-api
- Language: C#
- Homepage:
- Size: 69.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Congestion Tax Calculator
The application calculates congestion tax fees for vehicles.## Avaliable endpoints
The endpoints can be tested using postman or swagger.
following endpoint gets `city name`, `vehicle type` and `passess dates` as inputs and returns `tax amount`
##### Endpoint:
```
Post http://localhost:5000/api/tax/calculate
```##### Input from body:
```
Content-Type: application/json
{
"CityName": "Gothenburg",
"VehicleType": "Car",
"PassesDates": [
"2013-05-13T06:15:00",
"2013-05-13T08:45:00"
]
}
```## Technical details
- ASP.NET Core Web API -v8
- Entity Framework Core -v8
- DDD (Domain-Driven Design)
- TDD (Test-Driven Development)
- Clean Architecture
- Clean Code
- Repository Service Pattern
- PostgreSQL -v15
- Testcontainers for integration testing
- Fluent Assertions
- Docker
- Visual Studio 2022 -v17### Database design
The image shows the database schema for this application:
Database design
![Database Design](https://github.com/SaraRasoulian/Congestion-Tax-Calculator/assets/51083712/5000d8a4-56b5-4682-82a3-a7851215c6a0)
The CityTaxRules table has a one-to-many relationship with the Holidays, TaxAmounts, and TaxExemptVehicles tables.
Database created using Entity Framework Core migrations (code-first approach).
## Get started
#### 1. Clone the repository
```
git clone https://github.com/SaraRasoulian/Congestion-Tax-Calculator.git
```
#### 2. Start with docker composeMake sure [docker](https://docs.docker.com/get-docker/) is installed on your machine.
Run the following command in project directory:
```
docker-compose up -d
```Docker compose in this project includes 3 services:
- __Web API application__ will be running and listening at `http://localhost:5000`
- __Postgres database__ will be listening at `http://localhost:5433`
- __PgAdmin4 web interface__ will be listening at `http://localhost:8080`
To apply your modified code, you can add build option:
```
docker-compose up -d --build
```To stop and remove all containers, use the following command:
```
docker-compose down
```#### 3. Run the migrations
Open `CongestionTaxCalculator.sln` file in visual studio, then in package manager console tab, run:
```
update-database
```This command will generate the database schema in postgres container.