Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Simple Stock Manager

Simple Stock Manager is a simple Laravel app for managing your product stock & inventory control. Using this app you can easily see your product store status and its provides stock-taking and inventory management most simplistic way.

Simple Stock Manager Laravel App with Docker Environment

Requirements

Development environment requirements :

Setting up your development environment on your local machine:

Features

Also, this project uses other tools like:

Installation

First, clone this repo:

$ git clone https://github.com/IsiRoca/simple-stock-manager.git simple_stock_manager
$ cd simple_stock_manager

Run automatically (you need to have 'make' installed):

$ make install

All the installation process is fully automatic (yeap... it's magic!!).

This is a summary of the instructions that will be executed automatically:

$ cp .env.example .env
$ docker-compose run --rm --no-deps ssm-server composer install
$ docker-compose run --rm --no-deps ssm-server php artisan key:generate
$ docker-compose run --rm --no-deps ssm-server php artisan horizon:install
$ docker-compose run --rm --no-deps ssm-server php artisan telescope:install
$ docker-compose run --rm --no-deps ssm-server php artisan storage:link
$ docker run --rm -it -v $(pwd):/app -w /app node yarn
$ docker-compose up -d

and then... database migrations with test data

$ docker-compose run --rm ssm-server php artisan migrate
$ docker-compose run --rm ssm-server php artisan db:seed
$ docker run --rm -it -v $(pwd):/app -w /app node npm run dev
$ docker-compose run --rm ssm-server php artisan db:seed --class=DevDatabaseSeeder

This will create a new user that you can use to sign in:

email: superadmin@email.com
password: 1234

et voilá... l'installation est finie!!

Now you can access the application via http://localhost:8000. (massa cara...)

There is no need to run php artisan serve. PHP is already running in a dedicated container (more magic...).

Default API Access Data

You can access to the API application with this default data:

 -- Default Token --
3in9X94Rmz7NLzsQpjhub7KFRhheplhVFDzQWGx9dAjGszopil9SGMZZollQ

User Settings

Change your access data from:

http://YOUR-DOMAIN/settings/account

Change your password from:

http://YOUR-DOMAIN/settings/password

Copy your token from:

http://YOUR-DOMAIN/settings/token

Accessing the API

Clients can access to the REST API. API requests require authentication via token.

Your token

You can create a new token in your user profile.

http://YOUR-DOMAIN/settings/token

Authorization and parameters

Then, you can use this token either as url parameter or in Authorization header:

# Url parameter
GET http://YOUR-DOMAIN/api/v1/posts?api_token=your_private_token_here

# Authorization Header
curl --header "Authorization: Bearer your_private_token_here" http://YOUR-DOMAIN/api/v1/products

# Pagination parameter
GET http://YOUR-DOMAIN/api/v1/products?page=1

API routes

To list all the available routes for API :

$ docker-compose run --rm --no-deps ssm-server php artisan route:list --path=api

Some API endpoints examples

You have a collection to use with Postman in the .files folder

You can do some of the following actions with the API:

  • View all users, view specific user, create users or update users.
  • View all products, view specific product, create products, delete products or update products.
  • View all companies, view specific company, create companies, delete companies or update companies data.
  • View all products type, view specific product by type, create products types, delete products types or update products types data.
  • View all cities, view specific city, create cities, delete cities or update cities data.
  • View all countries, view specific country, create countries, delete countries or update countries data.
  • View products by city, view products by type, view companies by city or view cities by country.
  • and many more posibilities...

Products

$ api/v1/products
$ api/v1/products/{product}

Products Types

$ api/v1/types
$ api/v1/types/{type}
$ api/v1/types/{type}/products

Users

$ api/v1/users
$ api/v1/users/{user}
$ api/v1/users/{user}/companies
$ api/v1/users/{user}/products

Cities

$ api/v1/cities
$ api/v1/cities/{city}
$ api/v1/cities/{city}/companies
$ api/v1/cities/{city}/products

Countries

$ api/v1/countries
$ api/v1/countries/{country}
$ api/v1/countries/{country}/cities

Companies

$ api/v1/companies
$ api/v1/companies/{company}

API versions

API are prefixed by api and the API version number like so v1.

Do not forget to set the X-Requested-With header to XMLHttpRequest. Otherwise, Laravel won't recognize the call as an AJAX request.

Useful commands

Clear Application Cache

$ docker-compose run --rm ssm-server php artisan cache:clear

Clear Route Cache

$ docker-compose run --rm ssm-server php artisan route:clear

Clear Configuration Cache

$ docker-compose run --rm ssm-server php artisan config:clear 

Clear Compiled Views Cache

$ docker-compose run --rm ssm-server php artisan view:clear

Seeding the database :

$ docker-compose run --rm ssm-server php artisan db:seed

Generating fake data :

$ docker-compose run --rm ssm-server php artisan db:seed --class=DevDatabaseSeeder

Generating backup :

$ docker-compose run --rm ssm-server php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
$ docker-compose run --rm ssm-server php artisan backup:run

Starting job for newsletter :

$ docker-compose run ssm-server php artisan tinker
> PrepareNewsletterSubscriptionEmail::dispatch();

Running tests :

$ docker-compose run --rm ssm-server ./vendor/bin/phpunit --cache-result --order-by=defects --stop-on-defect

Running php-cs-fixer :

$ docker-compose run --rm --no-deps ssm-server ./vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --dry-run --diff

Discover package

$ docker-compose run --rm --no-deps ssm-server php artisan package:discover

In development environnement, rebuild the database :

$ docker-compose run --rm ssm-server php artisan migrate:fresh --seed

Uninstall Simple Stock Manager:

Be careful please, this command remove all ssm containers, his data, and all docker images

$ make uninstall

TODOs

  • Add swagger
  • Complete unit testing
  • Complete backend and frontend
  • Add more features to backend
  • Add Bulma Template
  • Add commands for automatization
  • Add database cache
  • and more things that can be interesting...

Contributing

Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.

License

This project is released under the MIT license.

About

Simple Stock Manager - A simple app for managing your product stock & inventory control.

Resources

License

Releases

No releases published

Packages

No packages published