This is an API designed for managing users and products. The system is built using the Laravel web framework and a relational database. It supports user authentication, product management, and role-based authorization, making it suitable for a variety of use cases, including e-commerce platforms.
- Docker.
- Laravel.
- Repository Pattern
- Abstracts the data access layer from the rest of the application and provides a clean separation of concerns.
- A repository is created for each model (User,Product) which are responsible for fetching and updating the data.
- Allows for easy switching of data sources or updating the data access logic without affecting the rest of the application.
- Mysql Database.
- Clone the repository to your local machine using
git clone https://github.com/dina103333/product-managment.git
. - Enter to project folder
cd product-managment
- run project by command
docker compose up --build
- featch project base url on port 8060
http://localhost:8060
- Run the test cases using
docker compose exec php php artisan test
.
Creates a new user in the system.
Request Body:
{
"name": "John Doe",
"email": "[email protected]",
"password": "password123",
"password_confirmation": "password123",
"role": "Super Admin", //this value must be User or Super Admin
"addresses": [
{
"address": "123 Main St, Apt 4B",
"is_checkpoint": true
},
{
"address": "456 Oak St"
}
]
}
Login a user to the system.
Request Body:
{
"email": "[email protected]",
"password": "password123"
}
Reset password of user.
Request Body:
{
"email": "[email protected]",
"password": "password123",
"password_confirmation": "password123"
}
Get user data by id.
update the user data.
Request Body:
{
"email": "[email protected]",
"password": "password123",
"password_confirmation": "password123",
"role": "User" //this value must be User or Super Admin
}
delete the user data.
crate new product.
Request Body:
{
"name": " ",
"description": "This is an example product description.",
"prices": {
"USD": 19.99,
"EUR": 17.99,
"GBP": 15.99
},
"stock_quantity": 100
}
show the specific product data .
update the product data.
Request Body:
{
"name": "Example Product",
"description": "This is an example product description.",
"prices": {
"USD": 20.99,
"EUR": 50.99,
"GBP": 15.99
},
"stock_quantity": 100
}
delete the product data.