diff --git a/.gitignore b/.gitignore index 53072ca..ac1bc03 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # Aptatio/Platformio specifics secrets.ini +.idea diff --git a/docker-compose-dolibarr.yml b/docker-compose-dolibarr.yml new file mode 100644 index 0000000..fb677a3 --- /dev/null +++ b/docker-compose-dolibarr.yml @@ -0,0 +1,22 @@ +version: "3" + +services: + mariadb: + image: mariadb:latest + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: dolibarr + + web: + image: tuxgasy/dolibarr + environment: + DOLI_DB_HOST: mariadb + DOLI_DB_USER: root + DOLI_DB_PASSWORD: root + DOLI_DB_NAME: dolibarr + DOLI_URL_ROOT: 'http://0.0.0.0' + PHP_INI_DATE_TIMEZONE: 'Europe/Paris' + ports: + - "80:80" + links: + - mariadb \ No newline at end of file diff --git a/docs/dolibarr/README.md b/docs/dolibarr/README.md index 0960045..e49ca4f 100644 --- a/docs/dolibarr/README.md +++ b/docs/dolibarr/README.md @@ -1 +1,58 @@ # Dolbarr documentation + +### Créer une instance de dev + +Pour créer une instance de développement, nous allons utiliser l'image docker de dolibarr: +https://hub.docker.com/r/tuxgasy/dolibarr/ + +pour simplifier l'installation, un docker-compose est disponible a la racine du projet `./docker-compose-dolibarr.yml` + +pour lancer dolibarr: +```shell +$ docker compose -f docker-compose-dolibarr.yml up +``` + +ensuite il faut se rendre sur http://0.0.0.0/ puis se login avec les credentials par défault (admin, admin) + + +### Api flow + +Base url: http://0.0.0.0/api/index.php/ + +Pour commencer, il faut récupérer l'api token d'un utilisateur pour pouvoir faire des requêtes api, assurer vous bien que l'utilisateurs a bien les permissions nécéssaires: + +![Api token user](../resources/image.png) + + +ensuite vous pouvez utiliser ce token pour chaque route API en ajoutant dans les headers: +DOLAPIKEY = {{votre_ap_token}} + +Récupérer le warehouse de base et vérifier son existance : + +``` + Method: GET + Url: warehouses/{id} +``` + + +Récupérer les produits disponibles: + +``` + Method: GET + Url: products?sortfield=t.ref&sortorder=ASC&limit=10000 +``` + +Pour créer un mouvement de stock: + +``` + Method: POST + Url: stockmovements?sortfield=t.rowid&sortorder=ASC&limit=100 + Body (JSON): + { + "product_id": "1", //string, - id of the product to move + "warehouse_id": "1", //string - id of the warehourse + "qty": 60, //int - quantity to move (1 for positive or -1 to remove one item) + "movementcode": "S-1", //string - code of the mouvement + "movementlabel": "Abc" //string - label of the mouvement +} +``` \ No newline at end of file diff --git a/docs/resources/image.png b/docs/resources/image.png new file mode 100644 index 0000000..0a50767 Binary files /dev/null and b/docs/resources/image.png differ