diff --git a/.gitignore b/api/.gitignore similarity index 100% rename from .gitignore rename to api/.gitignore diff --git a/Dockerfile b/api/Dockerfile similarity index 100% rename from Dockerfile rename to api/Dockerfile diff --git a/api/companies.js b/api/api/companies.js similarity index 100% rename from api/companies.js rename to api/api/companies.js diff --git a/api/hello.js b/api/api/hello.js similarity index 100% rename from api/hello.js rename to api/api/hello.js diff --git a/api/shareholders.js b/api/api/shareholders.js similarity index 100% rename from api/shareholders.js rename to api/api/shareholders.js diff --git a/api/shares.js b/api/api/shares.js similarity index 100% rename from api/shares.js rename to api/api/shares.js diff --git a/config.json b/api/config.json similarity index 100% rename from config.json rename to api/config.json diff --git a/docker-compose.yml b/api/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to api/docker-compose.yml diff --git a/index.js b/api/index.js similarity index 100% rename from index.js rename to api/index.js diff --git a/libs/mysql.js b/api/libs/mysql.js similarity index 100% rename from libs/mysql.js rename to api/libs/mysql.js diff --git a/package-lock.json b/api/package-lock.json similarity index 100% rename from package-lock.json rename to api/package-lock.json diff --git a/package.json b/api/package.json similarity index 100% rename from package.json rename to api/package.json diff --git a/client/actionnaire.py b/client/actionnaire.py new file mode 100644 index 0000000..b522be8 --- /dev/null +++ b/client/actionnaire.py @@ -0,0 +1,51 @@ +import requests + +"""Achat d'une action par un actionnaire à une entreprise + input : + - idBuyer : identifiant de l'actionnaire + - idShare : identifiant de l'action +""" +def buy(idBuyer, idShare): + url = '192.168.200.15/api/shares/buy' + obj={'id':idBuyer,'share_id':idShare} + r = requests.post(url, json=obj) + print(r.text) + +"""Affichage les actions possédées par un actionnaire + input : + - idBuyer : identifiant de l'actionnaire +""" +def showSharesOf(idBuyer): + url = '192.168.200.15/api/shareholders/'+idBuyer+'/shares' + r = requests.get(url) + print(r.text) + +"""Affichage les informations d'une actions + input : + - idShare : identifiant de l'action +""" +def showShare(idShare): + url = '192.168.200.15/api/shares/'+idShare + r = requests.get(url) + print(r.text) + +"""Affichage les actions en circulation sur le marché (possédées ou en vente) """ +def showAllShares(): + url = '192.168.200.15/api/shares' + r = requests.get(url) + print(r.text) + +"""Affichage les informations sur un actionnaire + input : + - idBuyer : identifiant de l'actionnaire +""" +def showInfoBuyer(idBuyer): + url='192.168.200.15/api/shareholders/'+idBuyer + r=requests.get(url) + print(r.text) + +"""Affichage tous les actionnaires """ +def showAllBuyers(): + url='192.168.200.15/api/shareholders/' + r=requests.get(url) + print(r.text) \ No newline at end of file diff --git a/client/entreprise.py b/client/entreprise.py new file mode 100644 index 0000000..4ecbd93 --- /dev/null +++ b/client/entreprise.py @@ -0,0 +1,36 @@ +import requests + +"""Affichage des actions mises en vente par une entreprise + input : + - idComp : Identifiant de l'entreprise +""" +def showShares(idComp): + url = '192.168.200.15/api/companies/'+idComp+'/shares' + r = requests.get(url) + print(r.text) + +"""Création d'une action par une entreprise + input : + - idComp : identifiant de l'entreprise + - price : prix de l'action sur le marché +""" +def newShare(idComp, price): + url = '192.168.200.15/api/shares/emmit' + obj={'id':idComp,'price':price} + r = requests.post(url, json=obj) + print(r.text) + +"""Affichage des informations d'une enteprise + input : + - idComp : identifiant de l'entreprise +""" +def showInfoComp(idComp): + url='192.168.200.15/api/companies/'+idComp + r=requests.get(url) + print(r.text) + +"""Affichage les enteprises """ +def showComp(): + url='192.168.200.15/api/companies/' + r=requests.get(url) + print(r.text) \ No newline at end of file