Browse Source

modifs remove upgrade version

formation 4 years ago
parent
commit
c8f047b416

+ 1 - 0
angular-client/src/app/components/auth/gain/gain-form/gain-form.component.ts

@@ -36,6 +36,7 @@ export class GainFormComponent implements OnInit {
 
 
 
 
   sendCodeGain() {
   sendCodeGain() {
+    console.log('toto')
     
     
     if (this.formGroup.invalid) {
     if (this.formGroup.invalid) {
       return;
       return;

+ 1 - 1
angular-client/src/app/components/auth/gain/gain.component.ts

@@ -14,7 +14,7 @@ export class GainComponent implements OnInit {
   constructor(private authService : AuthService, private userService : UsersService)
   constructor(private authService : AuthService, private userService : UsersService)
    { }
    { }
 
 
-  lots : Ticket[];
+  lots : Ticket[]=[];
   user : User;
   user : User;
 
 
   ngOnInit(): void {
   ngOnInit(): void {

+ 2 - 2
angular-client/src/app/components/auth/profil/profil.component.html

@@ -42,7 +42,7 @@
                             <p>Nom : </p>
                             <p>Nom : </p>
                         </div>
                         </div>
                         <div class="col-5">
                         <div class="col-5">
-                            <p>begaz</p>
+                            <p>{{user.firstname}}</p>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="row">
                     <div class="row">
@@ -50,7 +50,7 @@
                             <p>Prénom : </p>
                             <p>Prénom : </p>
                         </div>
                         </div>
                         <div class="col-5">
                         <div class="col-5">
-                            <p>ghiles</p>
+                            <p>{{user.lastname}}</p>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="row">
                     <div class="row">

+ 1 - 1
angular-client/src/app/services/auth.service.ts

@@ -17,7 +17,7 @@ import * as jwt_decode from 'jwt-decode';
 export class AuthService {
 export class AuthService {
 
 
   //url api
   //url api
-  private apiUrl = environment.apiUrl
+  private apiUrl = 'http://localhost:4000'
 
 
 
 
   private tokenSubject: BehaviorSubject<Token>;
   private tokenSubject: BehaviorSubject<Token>;

+ 1 - 1
angular-client/src/app/services/contact.service.ts

@@ -12,7 +12,7 @@ export class ContactService {
   constructor(private http: HttpClient) { }
   constructor(private http: HttpClient) { }
 
 
   //url api
   //url api
-  private apiUrl = environment.apiUrl
+  private apiUrl = 'http://localhost:4000'
 
 
   // send message contact
   // send message contact
   sendMsgContact(credentials): Observable<any> {
   sendMsgContact(credentials): Observable<any> {

+ 1 - 1
angular-client/src/app/services/email.service.ts

@@ -12,7 +12,7 @@ export class EmailService {
   constructor(private http : HttpClient) { }
   constructor(private http : HttpClient) { }
 
 
   //url api
   //url api
-  private apiUrl = environment.apiUrl
+  private apiUrl = 'http://localhost:4000'
 
 
 // send email 
 // send email 
 sendEmail(data : Email, email: string, isgain: string, isactiive: string): Observable<Email> {
 sendEmail(data : Email, email: string, isgain: string, isactiive: string): Observable<Email> {

+ 1 - 1
angular-client/src/app/services/restaurants.service.ts

@@ -12,7 +12,7 @@ export class RestaurantsService {
   constructor(private http : HttpClient) { }
   constructor(private http : HttpClient) { }
 
 
   //url api
   //url api
-  private apiUrl = environment.apiUrl
+  private apiUrl = 'http://localhost:4000'
 
 
   // get users
   // get users
 getRestaurants(): Observable<Restaurant[]> {
 getRestaurants(): Observable<Restaurant[]> {

+ 3 - 1
angular-client/src/app/services/users.service.ts

@@ -12,7 +12,7 @@ export class UsersService {
   constructor(private http : HttpClient) { }
   constructor(private http : HttpClient) { }
 
 
  //url api
  //url api
- private apiUrl = environment.apiUrl
+ private apiUrl = 'http://localhost:4000'
 
 
 // get all users
 // get all users
 getUsers(page: number, limit:number, lastname:string, firstname:string, email:string, adress:string, startregister, endregister): Observable <UserResponse> {
 getUsers(page: number, limit:number, lastname:string, firstname:string, email:string, adress:string, startregister, endregister): Observable <UserResponse> {
@@ -44,7 +44,9 @@ deleteOneUser(id: string): Observable <User> {
 
 
 // verifier gain user
 // verifier gain user
 verifyLotUser(id:string, code: Ticket): Observable <Ticket> {
 verifyLotUser(id:string, code: Ticket): Observable <Ticket> {
+  console.log('toto')
   return this.http.post<Ticket>(`${this.apiUrl}/api/users/gain?id=${id}`,code);
   return this.http.post<Ticket>(`${this.apiUrl}/api/users/gain?id=${id}`,code);
+  
 }
 }
 
 
 
 

+ 1 - 1
angular-client/src/environments/environment.ts

@@ -5,7 +5,7 @@
 export const environment = {
 export const environment = {
   production: false,
   production: false,
   name: "(Dev)",
   name: "(Dev)",
-  apiUrl: `http://api-dev.foodgame.fr`,
+  apiUrl: `http://localhost:4000`,
 };
 };
 
 
 /*
 /*

+ 4 - 4
express-server/lib/db.js

@@ -1,11 +1,11 @@
 const mongoose = require('mongoose');
 const mongoose = require('mongoose');
 const  config  = require('../config/config.json');
 const  config  = require('../config/config.json');
 
 
-//const db = config.url;
+const db = config.url;
 
 
-var db = 'mongodb://database_preprod:27017/mean-fatboar-db';
-//var mongoURI = 'mongodb://localhost:27017/my-db';
-// mongoose.set('useCreateIndex', true)
+//var db = 'mongodb://database_preprod:27017/mean-fatboar-db';
+var mongoURI = 'mongodb://localhost:27017/my-db';
+mongoose.set('useCreateIndex', true)
 mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })
 mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })
 .then(() => {
 .then(() => {
     console.log("Successfully connected to the database.");
     console.log("Successfully connected to the database.");

+ 39 - 27
express-server/node_modules/camelcase/index.js

@@ -1,64 +1,76 @@
 'use strict';
 'use strict';
 
 
-function preserveCamelCase(str) {
+const preserveCamelCase = string => {
 	let isLastCharLower = false;
 	let isLastCharLower = false;
 	let isLastCharUpper = false;
 	let isLastCharUpper = false;
 	let isLastLastCharUpper = false;
 	let isLastLastCharUpper = false;
 
 
-	for (let i = 0; i < str.length; i++) {
-		const c = str[i];
+	for (let i = 0; i < string.length; i++) {
+		const character = string[i];
 
 
-		if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) {
-			str = str.substr(0, i) + '-' + str.substr(i);
+		if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
+			string = string.slice(0, i) + '-' + string.slice(i);
 			isLastCharLower = false;
 			isLastCharLower = false;
 			isLastLastCharUpper = isLastCharUpper;
 			isLastLastCharUpper = isLastCharUpper;
 			isLastCharUpper = true;
 			isLastCharUpper = true;
 			i++;
 			i++;
-		} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) {
-			str = str.substr(0, i - 1) + '-' + str.substr(i - 1);
+		} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
+			string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
 			isLastLastCharUpper = isLastCharUpper;
 			isLastLastCharUpper = isLastCharUpper;
 			isLastCharUpper = false;
 			isLastCharUpper = false;
 			isLastCharLower = true;
 			isLastCharLower = true;
 		} else {
 		} else {
-			isLastCharLower = c.toLowerCase() === c;
+			isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
 			isLastLastCharUpper = isLastCharUpper;
 			isLastLastCharUpper = isLastCharUpper;
-			isLastCharUpper = c.toUpperCase() === c;
+			isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
 		}
 		}
 	}
 	}
 
 
-	return str;
-}
+	return string;
+};
+
+const camelCase = (input, options) => {
+	if (!(typeof input === 'string' || Array.isArray(input))) {
+		throw new TypeError('Expected the input to be `string | string[]`');
+	}
+
+	options = Object.assign({
+		pascalCase: false
+	}, options);
+
+	const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
 
 
-module.exports = function (str) {
-	if (arguments.length > 1) {
-		str = Array.from(arguments)
-			.map(x => x.trim())
+	if (Array.isArray(input)) {
+		input = input.map(x => x.trim())
 			.filter(x => x.length)
 			.filter(x => x.length)
 			.join('-');
 			.join('-');
 	} else {
 	} else {
-		str = str.trim();
+		input = input.trim();
 	}
 	}
 
 
-	if (str.length === 0) {
+	if (input.length === 0) {
 		return '';
 		return '';
 	}
 	}
 
 
-	if (str.length === 1) {
-		return str.toLowerCase();
+	if (input.length === 1) {
+		return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
 	}
 	}
 
 
-	if (/^[a-z0-9]+$/.test(str)) {
-		return str;
-	}
-
-	const hasUpperCase = str !== str.toLowerCase();
+	const hasUpperCase = input !== input.toLowerCase();
 
 
 	if (hasUpperCase) {
 	if (hasUpperCase) {
-		str = preserveCamelCase(str);
+		input = preserveCamelCase(input);
 	}
 	}
 
 
-	return str
+	input = input
 		.replace(/^[_.\- ]+/, '')
 		.replace(/^[_.\- ]+/, '')
 		.toLowerCase()
 		.toLowerCase()
-		.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase());
+		.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
+		.replace(/\d+(\w|$)/g, m => m.toUpperCase());
+
+	return postProcess(input);
 };
 };
+
+module.exports = camelCase;
+// TODO: Remove this for the next major release
+module.exports.default = camelCase;

+ 4 - 16
express-server/node_modules/camelcase/license

@@ -1,21 +1,9 @@
-The MIT License (MIT)
+MIT License
 
 
 Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
 Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
 
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 50 - 8
express-server/node_modules/camelcase/readme.md

@@ -1,12 +1,25 @@
 # camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
 # camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
 
 
-> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
+> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
 
 
+---
+
+<div align="center">
+	<b>
+		<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
+	</b>
+	<br>
+	<sub>
+		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+	</sub>
+</div>
+
+---
 
 
 ## Install
 ## Install
 
 
 ```
 ```
-$ npm install --save camelcase
+$ npm install camelcase
 ```
 ```
 
 
 
 
@@ -24,10 +37,10 @@ camelCase('foo_bar');
 camelCase('Foo-Bar');
 camelCase('Foo-Bar');
 //=> 'fooBar'
 //=> 'fooBar'
 
 
-camelCase('--foo.bar');
-//=> 'fooBar'
+camelCase('Foo-Bar', {pascalCase: true});
+//=> 'FooBar'
 
 
-camelCase('__foo__bar__');
+camelCase('--foo.bar', {pascalCase: false});
 //=> 'fooBar'
 //=> 'fooBar'
 
 
 camelCase('foo bar');
 camelCase('foo bar');
@@ -38,18 +51,47 @@ console.log(process.argv[3]);
 camelCase(process.argv[3]);
 camelCase(process.argv[3]);
 //=> 'fooBar'
 //=> 'fooBar'
 
 
-camelCase('foo', 'bar');
+camelCase(['foo', 'bar']);
 //=> 'fooBar'
 //=> 'fooBar'
 
 
-camelCase('__foo__', '--bar');
-//=> 'fooBar'
+camelCase(['__foo__', '--bar'], {pascalCase: true});
+//=> 'FooBar'
 ```
 ```
 
 
 
 
+## API
+
+### camelCase(input, [options])
+
+#### input
+
+Type: `string` `string[]`
+
+String to convert to camel case.
+
+#### options
+
+Type: `Object`
+
+##### pascalCase
+
+Type: `boolean`<br>
+Default: `false`
+
+Uppercase the first character: `foo-bar` → `FooBar`
+
+
+## Security
+
+To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
+
+
 ## Related
 ## Related
 
 
 - [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
 - [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
 - [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
 - [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
+- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
+- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
 
 
 
 
 ## License
 ## License

+ 6 - 4
express-server/routes/facebook.js

@@ -8,15 +8,17 @@ const passport = require('passport');
 const  FacebookStrategy  = require('passport-facebook').Strategy;
 const  FacebookStrategy  = require('passport-facebook').Strategy;
 
 
 passport.use(new FacebookStrategy({
 passport.use(new FacebookStrategy({
-    clientID: "858430034656858",
-    clientSecret: "fa4dc01a464dcea3b51d4ff538b79490",
-    callbackURL: "http://localhost:4000/api/auth/facebook/callback"
+    clientID: "318954999682335",
+    clientSecret: "9f8d5261decefbaf556f4c42539ee358",
+    callbackURL: "http://localhost:4000/api/auth/facebook/callback",
+    enableProof: false
   },
   },
+ 
   (accessToken, refreshToken, profile, done) => {
   (accessToken, refreshToken, profile, done) => {
    try{
    try{
     console.log('acces token ',accessToken);
     console.log('acces token ',accessToken);
     console.log('refresh token ',refreshToken);
     console.log('refresh token ',refreshToken);
-    console.log('prfile ',profile);
+    console.log('profile ',profile);
     console.log('done ',done);
     console.log('done ',done);
 }  catch(error){
 }  catch(error){
    console.log(error)
    console.log(error)

+ 3 - 3
express-server/routes/user.js

@@ -14,17 +14,17 @@ router.get("/",  UserController.getAllUsers);
 
 
 //get user by id
 //get user by id
 router.get('/:id',  UserController.getUserById);
 router.get('/:id',  UserController.getUserById);
-// router.get('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.getUserById);
+router.get('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.getUserById);
 
 
 //delete user by id
 //delete user by id
 router.delete('/:id', UserController.deleteUserById);
 router.delete('/:id', UserController.deleteUserById);
 
 
 //patch by id
 //patch by id
 router.patch('/:id',  UserController.patchUserById)
 router.patch('/:id',  UserController.patchUserById)
-// router.patch('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.patchUserById)
+router.patch('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.patchUserById)
 
 
 //post code gain
 //post code gain
-// router.post('/gain', authorize(Role.Client), GainController.gain);
+router.post('/gain', authorize(Role.Client), GainController.gain);
 router.post('/gain', GainController.gain);
 router.post('/gain', GainController.gain);