Skip to content

lucasdsalves/profits-distribution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Profits Distribution API

Distribute profits by employee based on admission time weight, occupational area weight and salary weight.

Technologies

  • .NET 5
  • REST API
  • Firebase Realtime Database
  • Swagger
  • XUnit
  • Moq, Bogus
  • AutoMapper
  • Clean Code
  • Clean Architecture

Installation / Configuration

Prerequisites: .NET 5 Runtime, Visual Studio / Visual Studio Code

$ git clone https://github.com/lucasdsalves/profits-distribution.git
cd profits-distribution
profits-distribution.sln

Database

It's already created and available to use through Firebase Realtime Database.
This API is already connected to it.
Although, connection settings are available on appsettings.json

Architecture

API: RESTful communication layer;
CrossCutting: Funcionalities for the entire application, such as Dependency Injection config;
Domain: Core entities layer;
Infra: Data persistence layer;
Service: Application business rules layer;
Tests: Tests layer using XUnit, Moq, Bogus.

Get All Employees

EmployeeController.cs

        [HttpGet("get-all")]
        [SwaggerOperation(
            Summary = "Get users collection from Firebase realtime database."
        )]
        public async Task<IActionResult> GetAllEmployees()
        {
            return Ok(await _employeeService.GetAllEmployeesAsync());
        }

Distribute Profits

ProfitsDistributionController.cs

        [HttpGet("distribute-profits")]
        [SwaggerOperation(
            Summary = "Distribute profits by employee and get its participation value."
        )]
        public async Task<IActionResult> DistributeProfits()
        {
            return Ok(await _profitsDistributionService.DistributeProfitsAsync());
        }