This repository contains a web API built using .NET Core, Entity Framework, MySQL database and Swagger to manage stock items, supplies, transfers and withdraw requests. The API has the following entities:
- Stock: Represents a collection of items and their associated quantities.
- Item: Represents a specific item in the stock, including its name, description, and measuring unit.
- Request: Represents a request to either supply, transfer, or withdraw items from the stock.
- User: Represents a user account with a unique username, email, and associated role.
- Role: Represents a role assigned to a user, such as manager, or employee.
- Request Type: Represents the type of request being made, such as supply, transfer, or withdraw.
- Measuring Unit: Represents the unit of measure for an item, such as pounds, ounces, or kilograms.
The API allows users to manage stocks, items, and requests with different levels of access control. The API can be accessed through Swagger UI to interact with the API using a user-friendly interface.
- .NET Core 5.0
- Entity Framework
- MySQL database
- Swagger
To get started with this project, follow these steps:
- Clone the repository to your local machine.
git clone https://github.com/seifhassan89/Stock-Management
- Navigate to the project directory.
cd stock-management
- Restore the project dependencies.
dotnet restore
To connect to your MySQL database, you need to update the connection string in the appsettings.json file with your own database information.
- Here is an example of the connection string format:
"ConnectionStrings": {
"DefaultConnection": "server=<server_name>;port=<port_number>;database=<database_name>;user=<user_name>;password=<password>"
}
Replace localhost with the name of your MySQL server, and database_name with the name of your database.
- Run the following command to create the database schema:
dotnet ef database update
- Here is command to run your application:
dotnet run
The API endpoints can be tested using a tool such as Postman. The following endpoints are available:
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new feature branch.
- Make your changes.
- Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.