Skip to content

hezbims/Backend-Inventory-System-NET

Repository files navigation

Prerequisite

  1. Install the necessary CLI tools :

    # The tools to generate OpenAPI Spec (swagger.json) after build is successful
    dotnet tool restore
  2. Set this in the ~/.bashrc

    export INVENTORY_SYSTEM_FE_API_SPEC_DIR=<Path-to-local-inventory-system-project>/api_spec/

    And then refresh the bashrc using command like this :

    source ~/.bashrc
  3. Now when we want to generate OpenAPI Spec (swagger.json), we can just run this command :

    dotnet build

Run The App

Make sure you are running the app from linux environement with docker compose and .NET SDK installed.

If you are using Windows OS, download the WSL and move this project to linux file system to avoid performance drawback. You can also use remote development tools such as Rider WSL Remote Development tools or Jetbrains Gateway to develop this app in WSL environement.

Here is the steps to run the app :

  1. Run this command in the terminal on the root of project :

    docker compose up -d   
    
  2. Wait for the SQL Server container to successfully running. You can check it using this command :

    docker exec -it inventory-system-local-sql-server /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "Strongpwd123_"
    

    The container is successfully running if the resulting output is like this :

    1>
    
  3. After that, you can go to Inv_Backend_NET folder, and then run following commands to run the app :

    # Run using default HTTP profile (Local ASPNETCORE_ENVIRONEMENT)
    dotnet run
    
    # Run for E2E Testing
    dotnet run --launch-profile e2e
  4. If you are using Windows, you can check the URL of the linux subsystem that is used to run this app by using this command in the linux terminal :

    hostname -I
    

Development Data Seeding

you can run this command in the Inv_Backend_NET folder to seed the initial data to the database for development purpose :

dotnet run refresh test-seeder

Target Project Structure

This is the expected project structure after refactoring. It is generated using tree.nathanfriend.com

1. Main Project Structure

Inv_Backend_NET
└── Feature
    ├── Transaction # using strict clean architecture because of rich domain logic
    │   ├── Application
    │   │   ├── Handler
    │   │   ├── Dto
    │   │   └── Read_Service
    │   ├── Domain
    │   │   ├── Exception
    │   │   ├── Entity
    │   │   ├── Dto
    │   │   ├── Mapper
    │   │   └── Value Object
    │   └── Presentation
    │       ├── Dto
    │       ├── Error_Translator
    │       └── Controller
    ├── Pengajuan # Same as transaction feature, but this is legacy
    ├── Product # using simple MVC and Transaction Script
    │   ├── Database
    │   │   ├── Model/Entity
    │   │   └── Configuration
    │   ├── Controller
    │   ├── Handler
    │   └── Dto
    ├── Reporting
    └── Authentication

There is 4 main features : Transaction, Product, Reporting, and Authentication

2. Test Project Structure

Inventory_Backend.Tests
├── Seeder
│   ├── ProductSeeder
│   ├── TransactionSeeder
│   └── UserSeeder
├── Test_Configuration
│   ├── Constant
│   ├── Fixture
│   ├── Collection_Definition
│   └── Logging
└── Feature
    ├── Transaction
    │   ├── Integration
    │   │   ├── Scenario1/Requirement1
    │   │   └── Scenario2/Requirement2
    │   └── Unit
    │       ├── Scenario1/Requirement1
    │       └── Scenario2/Requirement2
    ├── Pengajuan
    ├── Product
    ├── Reporting
    ├── Authentication
    └── Main_Setup

Integration testing currently utilize XUnit Collection Fixture. The container will be run once within all Integration Test using TestWebAppFactory.cs.

About

Backend ERP (Inventory Management) dengan ASP.NET Core. Support real-time multi-user interaction dengan SSE (Server sent event)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors