Giter VIP home page Giter VIP logo

giteugenel / invoice-manager Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 334 KB

Invoice management system, microservices. Vertical Slice Architecture, YARP reverse proxy, RabbitMq, request-response pattern, minimal api, QuestPDF, miniIO object storage, integration and unit tests.

License: Apache License 2.0

C# 98.09% Dockerfile 1.88% Makefile 0.03%
asp-net-core docker dotnet rabbitmq request-response-pattern vertical-slice-architecture csharp entity-framework fluentvalidation integration-tests minimal-api minio swagger xunit xunit-tests yarp

invoice-manager's Introduction

Invoice manager

Invoice management system, microservice architecture.

The services implement Vertical Slice Architecture, YARP reverse proxy, RabbitMq message broker, request-response pattern, minimal api, PFD file generation, miniIO object storage, integration and unit tests.

πŸ‘· Frameworks, Libraries and Technologies

πŸ—οΈ List of microservices

  • Gateway service: Single entry point to the application.

  • Identity service: User authentication.

  • Company service: Manages interactions with companies.

  • Invoice service: Manages interaction with the invoices.

  • FileGenerator service: Generates PDF files.

  • Storage service: Stores invoices in MinIO storage.

πŸ”οΈ Microservices diagram

Microservices diagram

🐳 List of docker containers

  • gateway.api - reverse proxy gateway container.

  • rabbitmq - message broker container.

  • minio - object storage for storage service.

  • storage.api - asp.net app container for storage service.

  • file-generator.api - asp.net app container for file generator service.

  • identity.api - asp.net app container for identity service.

  • identity.api.database - postgresql database container for identity service.

  • company.api - asp.net app container for company service.

  • company.api.database - postgresql database container for company service.

  • invoice.api - asp.net app container for invoice service.

  • invoice.api.database - postgresql database container for invoice service.

🩺 How to run tests

Allows you to run all integration and unit tests.

> dotnet test  # donet SKD is required

🚜 How to run the server

  1. Build and start Docker images based on the configuration defined in the docker-compose.yml

    > make up  # docker-compose up --build
  2. Stop and remove containers

    > make down  # docker-compose down

πŸ” Service access

container port login password access
gateway.api 5000 - - http://localhost:5000
rabbitMQ 5672 / 15672 user password http://localhost:15672 (local access)
minIO 9000 / 9001 user password http://localhost:9001/login (local access)
fileGenerator.api - - - -
identity.api 8000 - - http://localhost:8000 (local access)
company.api 8001 - - http://localhost:8001 (local access)
invoice.api 8002 - - http://localhost:8002 (local access)
storage.api 8080 - - http://localhost:8080 (local access)
identity.api.database 5432 user password http://localhost:5432 (local access)
company.api.database 5433 user password http://localhost:5433 (local access)
invoice.api.database 5434 user password http://localhost:5434 (local access)

πŸ–¨οΈ Swagger UI documentation (local access)

  • Identity service

      http://localhost:8000/swagger/index.html
    
  • Company service

      http://localhost:8001/swagger/index.html  
    
  • Invoice service

      http://localhost:8002/swagger/index.html  
    
  • Storage service

      http://localhost:8080/swagger/index.html  
    

πŸ”§ Implementation features

Gateway base Url: http://localhost:5000


Identity service

Register

POST /auth/register(allows you to register)
Body
name type data type
email required string
password required string
Responses
http code content-type response
201 application/json {"userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "email": "string"}
400 application/json array
409 application/json string

Login

POST /auth/login(allows you to login, issues accessToken and refreshToken)
Body
name type data type
email required string
password required string
Responses
http code content-type response
200 application/json {"accessToken": "string", "refreshToken": "string", "refreshTokenExpires": "2024-04-21T17:42:12.146Z", "accessTokenType": "string"}
400 application/json array
404 application/json string

Refresh

POST /auth/refresh(allows to refresh access and refresh tokens)
Body
name type data type
"refreshToken" required string
Responses
http code content-type response
200 application/json {"accessToken": "string", "refreshToken": "string", "refreshTokenExpires": "2024-04-21T17:43:47.494Z", "accessTokenType": "string"}
400 application/json array
401 application/json string

Logout

POST /auth/logout(allows to logout and deactivates refresh tokens)
Body
name type data type
"refreshToken" required string
Responses
http code content-type response
204 application/json NoContent
400 application/json array
401 application/json string

Company service

Functionality that allows to manage and interact with companies

Create new companies (πŸ”’Token required)

POST /company(allows to create new companies πŸ”’οΈ[token required])
Body
name type data type
"name" required string
"taxNumber" required string
"city" required string
"street" required string
"houseNumber" required string
"postalCode" required string
Responses
http code content-type response
201 application/json {"companyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "taxNumber": "string", "city": "string", "street": "string", "houseNumber": "string", "postalCode": "string"}
400 application/json array
401 application/json string
403 application/json string

Update your companies (πŸ”’Token required)

PUT /company(allows to update your companies πŸ”’οΈ[token required])
Body
name type data type
"companyId" required uuid
"name" not required string
"taxNumber" not required string
"city" not required string
"street" not required string
"houseNumber" not required string
"postalCode" not required string
Responses
http code content-type response
200 application/json {"companyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "taxNumber": "string", "city": "string", "street": "string", "houseNumber": "string", "postalCode": "string"}
400 application/json array
401 application/json string
403 application/json string
404 application/json string

Delete your companies (πŸ”’Token required)

DELETE /company/{ id:uuid }(allows to delete your companies πŸ”’οΈ[token required])
Responses
http code content-type response
204 application/json NoContent
401 application/json string
403 application/json string
404 application/json string

Get all your companies (πŸ”’Token required)

GET /company(allows you to get all your companies πŸ”’οΈ[token required])
Parameters
name type data type
PageNumber not required int32
PageSize not required int32
Responses
http code content-type response
200 application/json {"items": [ { "companyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "taxNumber": "string", "city": "string", "street": "string", "houseNumber": "string", "postalCode": "string" } ], "pageNumber": 0, "totalPages": 0, "totalItemsCount": 0 }
401 application/json string
403 application/json string

Get one your company (πŸ”’Token required)

GET /company/{ id:uuid }(allows you to get one your company πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json {"companyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "taxNumber": "string", "city": "string", "street": "string", "houseNumber": "string", "postalCode": "string"}
401 application/json string
403 application/json string

Invoice service

Invoice

Functionality that allows to manage and interact with invoices

Create invoices (πŸ”’Token required)

POST /invoice(allows to create new invoices πŸ”’οΈ[token required])
Body
name type data type
"sellerCompanyId" required uuid
"buyerCompanyId" required uuid
"termsOfPayment" required int
"paymentType" required string
"status" required string
Responses
http code content-type response
201 application/json { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "sellerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "buyerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "number": "string", "totalNetPrice": 0, "totalGrossPrice": 0, "termsOfPayment": 0, "paymentType": "string", "status": "string", "itemsId": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"] }
400 application/json array
401 application/json string
403 application/json string
404 application/json string

Update your unfinished invoices (πŸ”’Token required)

PUT /invoice(allows to update your invoices πŸ”’οΈ[token required])
Body
name type data type
"invoiceId" required uuid
"status" required string
Responses
http code content-type response
200 application/json { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "sellerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "buyerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "number": "string", "totalNetPrice": 0, "totalGrossPrice": 0, "termsOfPayment": 0, "paymentType": "string", "status": "string", "itemsId": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"] }
400 application/json array
401 application/json string
403 application/json string
404 application/json string

Delete your unfinished invoices (πŸ”’Token required)

DELETE /invoice/{ id:uuid }(allows to delete your invoices πŸ”’οΈ[token required])
Responses
http code content-type response
204 application/json NoContent
401 application/json string
403 application/json string
404 application/json string

Finalize your unfinished invoices (πŸ”’Token required)

PATCH /invoice/lock/{ id:uuid }(allows to finalize your invoices πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json string
401 application/json string
403 application/json string
404 application/json string

Get all your invoices (πŸ”’Token required)

GET /invoice(allows you to get all your invoices πŸ”’οΈ[token required])
Parameters
name type data type
PageNumber not required int32
PageSize not required int32
Responses
http code content-type response
200 application/json [ { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "sellerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "buyerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "number": "string", "totalNetPrice": 0, "totalGrossPrice": 0, "termsOfPayment": 0, "paymentType": "string", "status": "string", "itemsId": [ "3fa85f64-5717-4562-b3fc-2c963f66afa6" ] } ]
401 application/json string
403 application/json string

Get one your invoice (πŸ”’Token required)

GET /invoice/{ id:uuid }(allows you to get one your company πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json [ { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "sellerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "buyerCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "number": "string", "totalNetPrice": 0, "totalGrossPrice": 0, "termsOfPayment": 0, "paymentType": "string", "status": "string", "itemsId": [ "3fa85f64-5717-4562-b3fc-2c963f66afa6" ] } ]
401 application/json string
403 application/json string

Invoice item

Functionality that allows to manage and interact with invoice items

Create new items on your unfinished invoice (πŸ”’Token required)

POST /item(allows to create new items πŸ”’οΈ[token required])
Body
name type data type
"invoiceId" required uuid
"name" required string
"amount" required int
"unit" required string
"vat" required string
"netPrice" required decimal
Responses
http code content-type response
201 application/json { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "amount": 0, "unit": "string", "vat": "string", "netPrice": 0, "sumNetPrice": 0, "sumGrossPrice": 0 }
400 application/json array
401 application/json string
403 application/json string
404 application/json string

Update items on your unfinished invoice (πŸ”’Token required)

PUT /item(allows to update your items πŸ”’οΈ[token required])
Body
name type data type
"itemId" required uuid
"name" not required string
"amount" not required int
"netPrice" not required decimal
Responses
http code content-type response
200 application/json { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "amount": 0, "unit": "string", "vat": "string", "netPrice": 0, "sumNetPrice": 0, "sumGrossPrice": 0 }
400 application/json array
401 application/json string
403 application/json string
404 application/json string

Delete items on your unfinished invoice (πŸ”’Token required)

DELETE /item/{ id:uuid }(allows to delete your items πŸ”’οΈ[token required])
Responses
http code content-type response
204 application/json NoContent
401 application/json string
403 application/json string
404 application/json string

Get all items by invoice (πŸ”’Token required)

GET /item/all-by-invoice/{ id:uuid }(allows you to get items by invoice πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json [ { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "amount": 0, "unit": "string", "vat": "string", "netPrice": 0, "sumNetPrice": 0, "sumGrossPrice": 0 } ]
401 application/json string
403 application/json string
404 application/json string

Get one item by id (πŸ”’Token required)

GET /item/{ id:uuid }(allows you to get one item πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json [ { "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "amount": 0, "unit": "string", "vat": "string", "netPrice": 0, "sumNetPrice": 0, "sumGrossPrice": 0 } ]
401 application/json string
403 application/json string
404 application/json string

Storage service

PDF file is created automatically when the invoice is finalized

Get names of all your PDF files (πŸ”’Token required)

GET /storage(allows to get names of all your PDF files πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/json [ "string", "string", ]
401 application/json string
403 application/json string
404 application/json string

Download your PDF file by name (πŸ”’Token required)

GET /storage/{ fileName:string }(allows to download your PDF file πŸ”’οΈ[token required])
Responses
http code content-type response
200 application/pdf PDFfile
401 application/json string
403 application/json string
404 application/json string

invoice-manager's People

Contributors

giteugenel avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.