Skip to content

Commit c8c17e9

Browse files
Ecole NaNEcole NaN
authored andcommitted
mon ajout
0 parents  commit c8c17e9

File tree

4,597 files changed

+454222
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,597 files changed

+454222
-0
lines changed

.idea/dictionaries/nan.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 417 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EasyFood.iml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="WEB_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$" />
6+
<orderEntry type="inheritedJdk" />
7+
<orderEntry type="sourceFolder" forTests="false" />
8+
</component>
9+
</module>

User.js

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
2+
let db;
3+
4+
5+
module.exports = (_db)=>{
6+
db = _db;
7+
return User
8+
}
9+
10+
11+
12+
let User = class {
13+
14+
static connexion(email, password){
15+
return new Promise((next)=>{
16+
db.query("SELECT * FROM users WHERE email = ? AND mot_de_passe = ?", [email, password])
17+
.then((result)=>{
18+
if(result[0] !== undefined){
19+
next(result[0])
20+
}
21+
else{
22+
next(new Error('Aucun User'))
23+
}
24+
})
25+
.catch((error)=>{
26+
next(error);
27+
})
28+
})
29+
}
30+
static inscription(element){
31+
return new Promise((next) => {
32+
db.query("INSERT INTO users (nom,prenoms,email,contacts,localite,sexe,mot_de_passe) VALUES(?,?,?,?,?,?,?)",[element.nom,element.prenoms,element.email,element.contacts,element.localite,element.sexe,element.passwordc])
33+
.then((result) => {
34+
if(result[0] !== undefined){
35+
next(result[0])
36+
}
37+
else{
38+
next(new Error('Erreur survenu lors de l\'inscription'))
39+
}
40+
})
41+
.catch((error)=>{
42+
next(error);
43+
})
44+
})
45+
}
46+
47+
static getPractizePublications(){
48+
return new Promise((next) =>{
49+
db.query('SELECT publications_good_practize.id as id_pub,publications_good_practize.objet,publications_good_practize.message,publications_good_practize.date_de_publication,publications_good_practize.id_user,users.nom,users.prenoms,users.email ,users.localite FROM publications_good_practize INNER JOIN users ON publications_good_practize.id_user = users.id ORDER BY publications_good_practize.id DESC')
50+
.then((result) =>{
51+
next(result)
52+
})
53+
.catch((error)=>{
54+
next(error)
55+
})
56+
})
57+
}
58+
59+
static getConseilSport(){
60+
return new Promise((next) =>{
61+
db.query('SELECT * FROM conseils_sports')
62+
.then((result) =>{
63+
next(result)
64+
})
65+
.catch((error)=>{
66+
next(error)
67+
})
68+
})
69+
}
70+
71+
static getPlats(){
72+
return new Promise((next) =>{
73+
db.query('SELECT * FROM bons_plats')
74+
.then((result) =>{
75+
next(result)
76+
})
77+
.catch((error)=>{
78+
next(error)
79+
})
80+
})
81+
}
82+
83+
static setPractizePublications(element,fichier){
84+
return new Promise((next)=>{
85+
db.query('INSERT INTO publications_good_practize (objet,message,fichier,id_user) VALUES(?,?,?,?)',[element.objet,element.message,fichier,element.id_user])
86+
.then((result)=>{
87+
if(result)
88+
{
89+
next(result)
90+
}
91+
else
92+
{
93+
next(new Error('erruer survenenue lors du serveur'));
94+
}
95+
96+
})
97+
.catch((error) =>{
98+
next(error)
99+
})
100+
101+
})
102+
}
103+
104+
static getCommentairesPractize(){
105+
return new Promise((next)=>{
106+
db.query('SELECT * FROM commmentaires_good_practize')
107+
.then((result)=>{
108+
if(result){
109+
next(result)
110+
}
111+
else
112+
{
113+
next(new Error('erreur survenue'));
114+
}
115+
})
116+
.catch((error)=>{
117+
next(error)
118+
})
119+
})
120+
}
121+
122+
static getCommentairesConseils(){
123+
return new Promise((next)=>{
124+
db.query('SELECT * FROM commentaires_advice')
125+
.then((result)=>{
126+
if(result){
127+
next(result)
128+
}
129+
else
130+
{
131+
next(new Error('erreur survenue'));
132+
}
133+
})
134+
.catch((error)=>{
135+
next(error)
136+
})
137+
})
138+
}
139+
140+
static getCommentairesPlats(){
141+
return new Promise((next)=>{
142+
db.query('SELECT * FROM commentaires_plats')
143+
.then((result)=>{
144+
if(result){
145+
next(result)
146+
}
147+
else
148+
{
149+
next(new Error('erreur survenue'));
150+
}
151+
})
152+
.catch((error)=>{
153+
next(error)
154+
})
155+
})
156+
}
157+
158+
159+
static setCommentairesPractize(element){
160+
return new Promise((next)=>{
161+
db.query('INSERT INTO commmentaires_good_practize (name,commentaire,id_publication) VALUES (?,?,?)',[element.name,element.commentaire,element.id_publication])
162+
.then((result)=>{
163+
if(result){
164+
next(result)
165+
}
166+
else
167+
{
168+
next(new Error('erreur survenue'))
169+
}
170+
})
171+
.catch((error)=>{
172+
next(error)
173+
})
174+
})
175+
}
176+
177+
static setCommentairesConseils(element){
178+
return new Promise((next)=>{
179+
db.query('INSERT INTO commentaires_advice (name,commentaire,id_advice) VALUES (?,?,?)',[element.name,element.commentaire,element.id_publication])
180+
.then((result)=>{
181+
if(result){
182+
next(result)
183+
}
184+
else
185+
{
186+
next(new Error('erreur survenue'))
187+
}
188+
})
189+
.catch((error)=>{
190+
next(error)
191+
})
192+
})
193+
}
194+
195+
static getRecettesPlats(element){
196+
return new Promise((next)=>{
197+
db.query('SELECT bons_plats.id as id_p,bons_plats.nom,bons_plats.image,bons_plats.description,recettes_plats.description as recette_dep,recettes_plats.id_plats FROM bons_plats INNER JOIN recettes_plats ON bons_plats.id = recettes_plats.id_plats WHERE recettes_plats.id_plats = ?',[element])
198+
.then((result)=>{
199+
if(result[0] !== undefined){
200+
next(result[0])
201+
}
202+
else
203+
{
204+
next(new Error('erreur survenue'))
205+
}
206+
})
207+
.catch((error)=>{
208+
next(error)
209+
})
210+
})
211+
}
212+
213+
214+
static setCommentairesPlats(element){
215+
return new Promise((next)=>{
216+
db.query('INSERT INTO commentaires_plats (name,description,id_plats) VALUES (?,?,?)',[element.name,element.description,element.id_plat])
217+
.then((result)=>{
218+
if(result){
219+
next(result)
220+
}
221+
else
222+
{
223+
next(new Error('erreur survenue'))
224+
}
225+
})
226+
.catch((error)=>{
227+
next(error)
228+
})
229+
})
230+
}
231+
232+
233+
static deletePractizePublications(element){
234+
return new Promise((next)=>{
235+
db.query('DELETE FROM commmentaires_good_practize WHERE id_publication = ?',[element.id])
236+
.then((resultat)=>{
237+
if(resultat)
238+
{
239+
db.query('DELETE FROM publications_good_practize WHERE id = ? AND id_user = ?',[element.id,element.id_user])
240+
.then((result)=>{
241+
if(result)
242+
{
243+
next(result);
244+
}
245+
else
246+
{
247+
next(new Error('erreur lors de la suppression'));
248+
}
249+
})
250+
.catch((error)=>{
251+
next(error)
252+
})
253+
}
254+
else
255+
{
256+
next(new Error('il ya une erreur'))
257+
}
258+
})
259+
.catch((error)=>{
260+
next(error)
261+
})
262+
263+
})
264+
}
265+
266+
}

config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"rootApi" : "/",
3+
"port" : "8080",
4+
"db" : {
5+
"host" :"localhost",
6+
"database" :"easyfood_db",
7+
"user":"root",
8+
"password":""
9+
},
10+
"session" : {
11+
"secret": "8384cad041069d05fdeeaf3bd280a317273e19069bf8c76f71174e01674578c6",
12+
"resave" : false,
13+
"saveUninitialized" : false
14+
}
15+
}

0 commit comments

Comments
 (0)