Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Projectname

Inventory-Order-Management-Api

LIVE-DEMO on monsterasp.net

https://inventoryordermanagementapi.runasp.net/index.html

Features

  • RESTful API
  • Swagger/OpenAPI-Documentation
  • JWT-Authentification
  • Role Based Access Control (RBAC)
  • InMemory-Caching
  • Deployment on monsterasp.net

Technologies

  • .NET 10 Sdk
  • Entity Framework Core
  • ASP.NET Core Identity
  • Swagger / OpenAPI
  • Sqlite

How to run the API on your local machine

1. Installation

git clone https://github.com/msass89/InventoryOrderManagementApi.git
cd API

2. Restore packages:

dotnet restore

3. Configuration

appsettings.json

{
  "Jwt": {
    "Issuer": "...",
    "Audience": "...",
    "Key": "..."
  }
}

Alternatively it's recommended to set the JWT key by setting a user secret or an environment variable.

4. Run database migrations

dotnet ef database update

5. Start Application

dotnet run

Swagger UI

The swagger UI is set to the root and is starting automatically when running the Api.

API-Endpoints

Method Route Description
POST /api/auth/register Register a new user
POST /api/auth/login Login as a new user
GET /api/inventory Return all items in the inventory
GET /api/inventory/{id} Return item by Id
POST /api/inventory Create new Item
DELETE /api/inventory/{id} Delete item by Id
GET /api/orders Return all orders
GET /api/orders/{id} Return order by Id
POST /api/orders Create an orders
DELETE /api/orders/{id} Delete an order by Id

Authentification and Authorization

This API is secured by JWT authentification and RBAC-based authorizaiton.

For accessing the endpoints please follow these steps:

  1. Use the endpoint 'api/auth/register' to register as a new user by providing a (fake) email adress, a password and the role. Possible roles are 'Admin', 'SalesAgent', 'InventoryAgent' or 'Customer'.
  2. Use the endpoint 'api/auth/login' in order to login with your provided user name and credentials.
  3. Copy the token in the API response without the parentheses.
  4. Click on 'Authorize' on the upper right corner of the Swagger UI.
  5. Paste the copied token into the input field.
  6. Confirm by clicking on 'Authorize'.

Now you are able to access the secured endpoints according to the user role.

Projectstructure

Controller/
Data/
  Seed/
Migrations/
Models/
  DTO/
  Entities/
  Enums/

Program.cs

Licence

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages