From 0d6cca625c46d313439d29f0e13bb4744d658717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20VACHOT?= Date: Wed, 22 Dec 2021 12:15:32 +0100 Subject: [PATCH] Update: Environment for Heroku Production --- .gitignore | 7 - Dockerfile | 6 - README.md | 12 +- admin/.browserslistrc | 17 - admin/.editorconfig | 16 - admin/.gitignore | 45 -- admin/README.md | 27 - admin/package.json | 44 -- admin/src/environments/environment.prod.ts | 4 - admin/angular.json => angular.json | 0 app-backend/config/functions.config.js | 26 - app-backend/config/host.config.js | 26 - app-backend/config/mongodb.config.js | 4 - app-backend/config/response.config.js | 9 - app-backend/config/sessionJWT.config.js | 109 ---- app-backend/controllers/ad.controller.js | 290 ---------- app-backend/controllers/misc.controller.js | 7 - .../controllers/playlist.controller.js | 407 ------------- app-backend/controllers/user.controller.js | 546 ------------------ app-backend/controllers/video.controller.js | 473 --------------- app-backend/jwtRS256.key | 51 -- app-backend/jwtRS256.key.pub | 14 - app-backend/jwtRS256.sh | 8 - app-backend/models/database/ads.model.js | 44 -- .../models/database/playlists.model.js | 24 - app-backend/models/database/users.model.js | 48 -- app-backend/models/database/videos.model.js | 29 - app-backend/models/mongodb.model.js | 19 - app-backend/models/objects/image.model.js | 10 - app-backend/models/objects/role.model.js | 22 - .../models/objects/video.categories.model.js | 157 ----- app-backend/routes/ad.routes.js | 24 - app-backend/routes/misc.routes.js | 9 - app-backend/routes/playlist.routes.js | 24 - app-backend/routes/user.routes.js | 42 -- app-backend/routes/video.routes.js | 30 - docker-compose.yml | 41 -- admin/karma.conf.js => karma.conf.js | 2 +- package.json | 71 +-- server.js | 71 --- .../page-ad-list-admin.component.html | 0 .../page-ad-list-admin.component.scss | 0 .../page-ad-list-admin.component.spec.ts | 0 .../page-ad-list-admin.component.ts | 0 .../popup-delete-ad-admin.component.html | 0 .../popup-delete-ad-admin.component.scss | 0 .../popup-delete-ad-admin.component.spec.ts | 0 .../popup-delete-ad-admin.component.ts | 0 ...opup-visualize-images-admin.component.html | 0 ...opup-visualize-images-admin.component.scss | 0 ...p-visualize-images-admin.component.spec.ts | 0 .../popup-visualize-images-admin.component.ts | 0 .../page-profil-admin.component.html | 0 .../page-profil-admin.component.scss | 0 .../page-profil-admin.component.spec.ts | 0 .../page-profil-admin.component.ts | 0 .../popup-update-admin.component.html | 0 .../popup-update-admin.component.scss | 0 .../popup-update-admin.component.spec.ts | 0 .../popup-update-admin.component.ts | 0 .../input-interests-admin.component.html | 0 .../input-interests-admin.component.scss | 0 .../input-interests-admin.component.spec.ts | 0 .../input-interests-admin.component.ts | 0 .../page-user-list.component.html | 0 .../page-user-list.component.scss | 0 .../page-user-list.component.spec.ts | 0 .../page-user-list.component.ts | 0 .../popup-create-user.component.html | 0 .../popup-create-user.component.scss | 0 .../popup-create-user.component.spec.ts | 0 .../popup-create-user.component.ts | 0 .../popup-delete-user.component.html | 0 .../popup-delete-user.component.scss | 0 .../popup-delete-user.component.spec.ts | 0 .../popup-delete-user.component.ts | 0 .../navbar-admin/navbar-admin.component.html | 0 .../navbar-admin/navbar-admin.component.scss | 0 .../navbar-admin.component.spec.ts | 0 .../navbar-admin/navbar-admin.component.ts | 0 {admin/src => src}/app/app-routing.module.ts | 0 {admin/src => src}/app/app.component.html | 0 {admin/src => src}/app/app.component.scss | 0 {admin/src => src}/app/app.component.spec.ts | 0 {admin/src => src}/app/app.component.ts | 0 {admin/src => src}/app/app.module.ts | 0 .../page-login/page-login.component.html | 0 .../page-login/page-login.component.scss | 0 .../page-login/page-login.component.spec.ts | 0 .../login/page-login/page-login.component.ts | 0 .../popup-forgotten-password.component.html | 0 .../popup-forgotten-password.component.scss | 0 ...popup-forgotten-password.component.spec.ts | 0 .../popup-forgotten-password.component.ts | 0 .../input-interests-register.component.html | 0 .../input-interests-register.component.scss | 0 ...input-interests-register.component.spec.ts | 0 .../input-interests-register.component.ts | 0 .../page-register.component.html | 0 .../page-register.component.scss | 0 .../page-register.component.spec.ts | 0 .../page-register/page-register.component.ts | 0 .../popup-confirmation.component.html | 0 .../popup-confirmation.component.scss | 0 .../popup-confirmation.component.spec.ts | 0 .../popup-confirmation.component.ts | 0 .../navbar-before-connexion.component.html | 0 .../navbar-before-connexion.component.scss | 0 .../navbar-before-connexion.component.spec.ts | 0 .../navbar-before-connexion.component.ts | 0 .../app/utils/message/message.service.spec.ts | 0 .../app/utils/message/message.service.ts | 0 .../app/utils/profil/profil.service.spec.ts | 0 .../app/utils/profil/profil.service.ts | 0 .../app/utils/theme/theme.service.spec.ts | 0 .../app/utils/theme/theme.service.ts | 0 {admin/src => src}/assets/.gitkeep | 0 {admin/src => src}/assets/darkBackground.webp | Bin {admin/src => src}/assets/lightBackground.jpg | Bin {admin/src => src}/assets/logo.png | Bin .../assets/logo_plateforms/dailymotion.png | Bin .../assets/logo_plateforms/youtube.png | Bin {admin/src => src}/assets/play.png | Bin {admin/src => src}/assets/profil.png | Bin {admin/src => src}/assets/uploadFile.png | Bin src/environments/environment.prod.ts | 4 + .../src => src}/environments/environment.ts | 0 {admin/src => src}/favicon.ico | Bin {admin/src => src}/index.html | 0 {admin/src => src}/main.ts | 0 {admin/src => src}/polyfills.ts | 0 {admin/src => src}/styles.scss | 0 {admin/src => src}/test.ts | 0 admin/tsconfig.app.json => tsconfig.app.json | 0 admin/tsconfig.json => tsconfig.json | 0 .../tsconfig.spec.json => tsconfig.spec.json | 0 136 files changed, 35 insertions(+), 2784 deletions(-) delete mode 100644 Dockerfile delete mode 100644 admin/.browserslistrc delete mode 100644 admin/.editorconfig delete mode 100644 admin/.gitignore delete mode 100644 admin/README.md delete mode 100644 admin/package.json delete mode 100644 admin/src/environments/environment.prod.ts rename admin/angular.json => angular.json (100%) delete mode 100644 app-backend/config/functions.config.js delete mode 100644 app-backend/config/host.config.js delete mode 100644 app-backend/config/mongodb.config.js delete mode 100644 app-backend/config/response.config.js delete mode 100644 app-backend/config/sessionJWT.config.js delete mode 100644 app-backend/controllers/ad.controller.js delete mode 100644 app-backend/controllers/misc.controller.js delete mode 100644 app-backend/controllers/playlist.controller.js delete mode 100644 app-backend/controllers/user.controller.js delete mode 100644 app-backend/controllers/video.controller.js delete mode 100644 app-backend/jwtRS256.key delete mode 100644 app-backend/jwtRS256.key.pub delete mode 100755 app-backend/jwtRS256.sh delete mode 100644 app-backend/models/database/ads.model.js delete mode 100644 app-backend/models/database/playlists.model.js delete mode 100644 app-backend/models/database/users.model.js delete mode 100644 app-backend/models/database/videos.model.js delete mode 100644 app-backend/models/mongodb.model.js delete mode 100644 app-backend/models/objects/image.model.js delete mode 100644 app-backend/models/objects/role.model.js delete mode 100644 app-backend/models/objects/video.categories.model.js delete mode 100644 app-backend/routes/ad.routes.js delete mode 100644 app-backend/routes/misc.routes.js delete mode 100644 app-backend/routes/playlist.routes.js delete mode 100644 app-backend/routes/user.routes.js delete mode 100644 app-backend/routes/video.routes.js delete mode 100644 docker-compose.yml rename admin/karma.conf.js => karma.conf.js (98%) rename {admin/src => src}/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html (100%) rename {admin/src => src}/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.scss (100%) rename {admin/src => src}/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.ts (100%) rename {admin/src => src}/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.html (100%) rename {admin/src => src}/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.scss (100%) rename {admin/src => src}/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.ts (100%) rename {admin/src => src}/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.html (100%) rename {admin/src => src}/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.scss (100%) rename {admin/src => src}/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.ts (100%) rename {admin/src => src}/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html (100%) rename {admin/src => src}/app/admin/myProfil/page-profil-admin/page-profil-admin.component.scss (100%) rename {admin/src => src}/app/admin/myProfil/page-profil-admin/page-profil-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/myProfil/page-profil-admin/page-profil-admin.component.ts (100%) rename {admin/src => src}/app/admin/myProfil/popup-update-admin/popup-update-admin.component.html (100%) rename {admin/src => src}/app/admin/myProfil/popup-update-admin/popup-update-admin.component.scss (100%) rename {admin/src => src}/app/admin/myProfil/popup-update-admin/popup-update-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts (100%) rename {admin/src => src}/app/admin/userList/input-interests-admin/input-interests-admin.component.html (100%) rename {admin/src => src}/app/admin/userList/input-interests-admin/input-interests-admin.component.scss (100%) rename {admin/src => src}/app/admin/userList/input-interests-admin/input-interests-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/userList/input-interests-admin/input-interests-admin.component.ts (100%) rename {admin/src => src}/app/admin/userList/page-user-list/page-user-list.component.html (100%) rename {admin/src => src}/app/admin/userList/page-user-list/page-user-list.component.scss (100%) rename {admin/src => src}/app/admin/userList/page-user-list/page-user-list.component.spec.ts (100%) rename {admin/src => src}/app/admin/userList/page-user-list/page-user-list.component.ts (100%) rename {admin/src => src}/app/admin/userList/popup-create-user/popup-create-user.component.html (100%) rename {admin/src => src}/app/admin/userList/popup-create-user/popup-create-user.component.scss (100%) rename {admin/src => src}/app/admin/userList/popup-create-user/popup-create-user.component.spec.ts (100%) rename {admin/src => src}/app/admin/userList/popup-create-user/popup-create-user.component.ts (100%) rename {admin/src => src}/app/admin/userList/popup-delete-user/popup-delete-user.component.html (100%) rename {admin/src => src}/app/admin/userList/popup-delete-user/popup-delete-user.component.scss (100%) rename {admin/src => src}/app/admin/userList/popup-delete-user/popup-delete-user.component.spec.ts (100%) rename {admin/src => src}/app/admin/userList/popup-delete-user/popup-delete-user.component.ts (100%) rename {admin/src => src}/app/admin/utils/navbar-admin/navbar-admin.component.html (100%) rename {admin/src => src}/app/admin/utils/navbar-admin/navbar-admin.component.scss (100%) rename {admin/src => src}/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts (100%) rename {admin/src => src}/app/admin/utils/navbar-admin/navbar-admin.component.ts (100%) rename {admin/src => src}/app/app-routing.module.ts (100%) rename {admin/src => src}/app/app.component.html (100%) rename {admin/src => src}/app/app.component.scss (100%) rename {admin/src => src}/app/app.component.spec.ts (100%) rename {admin/src => src}/app/app.component.ts (100%) rename {admin/src => src}/app/app.module.ts (100%) rename {admin/src => src}/app/beforeConnexion/login/page-login/page-login.component.html (100%) rename {admin/src => src}/app/beforeConnexion/login/page-login/page-login.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/login/page-login/page-login.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/login/page-login/page-login.component.ts (100%) rename {admin/src => src}/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.html (100%) rename {admin/src => src}/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/input-interests-register/input-interests-register.component.html (100%) rename {admin/src => src}/app/beforeConnexion/register/input-interests-register/input-interests-register.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/register/input-interests-register/input-interests-register.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/page-register/page-register.component.html (100%) rename {admin/src => src}/app/beforeConnexion/register/page-register/page-register.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/register/page-register/page-register.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/page-register/page-register.component.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.html (100%) rename {admin/src => src}/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.ts (100%) rename {admin/src => src}/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html (100%) rename {admin/src => src}/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss (100%) rename {admin/src => src}/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts (100%) rename {admin/src => src}/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts (100%) rename {admin/src => src}/app/utils/message/message.service.spec.ts (100%) rename {admin/src => src}/app/utils/message/message.service.ts (100%) rename {admin/src => src}/app/utils/profil/profil.service.spec.ts (100%) rename {admin/src => src}/app/utils/profil/profil.service.ts (100%) rename {admin/src => src}/app/utils/theme/theme.service.spec.ts (100%) rename {admin/src => src}/app/utils/theme/theme.service.ts (100%) rename {admin/src => src}/assets/.gitkeep (100%) rename {admin/src => src}/assets/darkBackground.webp (100%) rename {admin/src => src}/assets/lightBackground.jpg (100%) rename {admin/src => src}/assets/logo.png (100%) rename {admin/src => src}/assets/logo_plateforms/dailymotion.png (100%) rename {admin/src => src}/assets/logo_plateforms/youtube.png (100%) rename {admin/src => src}/assets/play.png (100%) rename {admin/src => src}/assets/profil.png (100%) rename {admin/src => src}/assets/uploadFile.png (100%) create mode 100644 src/environments/environment.prod.ts rename {admin/src => src}/environments/environment.ts (100%) rename {admin/src => src}/favicon.ico (100%) rename {admin/src => src}/index.html (100%) rename {admin/src => src}/main.ts (100%) rename {admin/src => src}/polyfills.ts (100%) rename {admin/src => src}/styles.scss (100%) rename {admin/src => src}/test.ts (100%) rename admin/tsconfig.app.json => tsconfig.app.json (100%) rename admin/tsconfig.json => tsconfig.json (100%) rename admin/tsconfig.spec.json => tsconfig.spec.json (100%) diff --git a/.gitignore b/.gitignore index 323a898..de51f68 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ # profiling files chrome-profiler-events*.json -speed-measure-plugin*.json # IDEs and editors /.idea @@ -40,13 +39,7 @@ npm-debug.log yarn-error.log testem.log /typings -*.env # System Files .DS_Store Thumbs.db - -/backend/database/ -/backend/node_modules/ - -package-lock.json diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 55a30a2..0000000 --- a/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM node:current-slim -WORKDIR /app-frontend -COPY ["package.json", "package-lock.json*", "./"] -RUN npm install --NODE_ENV -RUN npm install -g @angular/cli -COPY . . diff --git a/README.md b/README.md index 13b2e84..a653293 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# Frontend +# Admin -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.7. +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.10. ## Development server Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. ## Code scaffolding -à -Run `ng generate component component-title` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. ## Build -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. ## Running unit tests @@ -20,7 +20,7 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github. ## Running end-to-end tests -Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). +Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. ## Further help diff --git a/admin/.browserslistrc b/admin/.browserslistrc deleted file mode 100644 index 427441d..0000000 --- a/admin/.browserslistrc +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries - -# For the full list of supported browsers by the Angular framework, please see: -# https://angular.io/guide/browser-support - -# You can see what browsers were selected by your queries by running: -# npx browserslist - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major versions -last 2 iOS major versions -Firefox ESR -not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. diff --git a/admin/.editorconfig b/admin/.editorconfig deleted file mode 100644 index 59d9a3a..0000000 --- a/admin/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# Editor configuration, see https://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.ts] -quote_type = single - -[*.md] -max_line_length = off -trim_trailing_whitespace = false diff --git a/admin/.gitignore b/admin/.gitignore deleted file mode 100644 index de51f68..0000000 --- a/admin/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist -/tmp -/out-tsc -# Only exists if Bazel was run -/bazel-out - -# dependencies -/node_modules - -# profiling files -chrome-profiler-events*.json - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history/* - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -yarn-error.log -testem.log -/typings - -# System Files -.DS_Store -Thumbs.db diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index a653293..0000000 --- a/admin/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Admin - -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.10. - -## Development server - -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. - -## Code scaffolding - -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. - -## Build - -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. - -## Running unit tests - -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). - -## Running end-to-end tests - -Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/admin/package.json b/admin/package.json deleted file mode 100644 index 1e0e314..0000000 --- a/admin/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "admin", - "version": "0.0.0", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "ng test" - }, - "private": true, - "dependencies": { - "@angular/animations": "~12.2.0", - "@angular/cdk": "^13.1.1", - "@angular/common": "~12.2.0", - "@angular/compiler": "~12.2.0", - "@angular/core": "~12.2.0", - "@angular/forms": "~12.2.0", - "@angular/material": "^13.1.1", - "@angular/platform-browser": "~12.2.0", - "@angular/platform-browser-dynamic": "~12.2.0", - "@angular/router": "~12.2.0", - "bootstrap": "^5.1.3", - "jquery": "^3.6.0", - "popper": "^1.0.1", - "rxjs": "~6.6.0", - "tslib": "^2.3.0", - "zone.js": "~0.11.4" - }, - "devDependencies": { - "@angular-devkit/build-angular": "~12.2.10", - "@angular/cli": "~12.2.10", - "@angular/compiler-cli": "~12.2.0", - "@types/jasmine": "~3.8.0", - "@types/node": "^12.11.1", - "jasmine-core": "~3.8.0", - "karma": "~6.3.0", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.0.3", - "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "~1.7.0", - "typescript": "~4.3.5" - } -} diff --git a/admin/src/environments/environment.prod.ts b/admin/src/environments/environment.prod.ts deleted file mode 100644 index 8d9f516..0000000 --- a/admin/src/environments/environment.prod.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const environment = { - production: true, - debutUrl: "https://polynotfound.herokuapp.com/api/" -}; diff --git a/admin/angular.json b/angular.json similarity index 100% rename from admin/angular.json rename to angular.json diff --git a/app-backend/config/functions.config.js b/app-backend/config/functions.config.js deleted file mode 100644 index b229914..0000000 --- a/app-backend/config/functions.config.js +++ /dev/null @@ -1,26 +0,0 @@ -const request = require("request"); -const VideoCategories = require("../models/objects/video.categories.model"); - -function asyncRequest(uri, option){ - return new Promise(function(resolve){ - request(uri, option,function (error, response, body){ - resolve({response: response, body: JSON.parse(body)}); - }); - }); -} -module.exports.asyncRequest = asyncRequest; - -function asyncInterest(interest, source){ - return new Promise(function(resolve){ - for(const i in VideoCategories){ - for(const j in VideoCategories[i].categories){ - if((VideoCategories[i].categories[j].name === interest || VideoCategories[i].categories[j].id === interest) - && VideoCategories[i].categories[j].source === source){ - resolve(VideoCategories[i].interest); - } - } - } - resolve(null); - }); -} -module.exports.asyncInterest = asyncInterest; diff --git a/app-backend/config/host.config.js b/app-backend/config/host.config.js deleted file mode 100644 index 6a62f28..0000000 --- a/app-backend/config/host.config.js +++ /dev/null @@ -1,26 +0,0 @@ -if(process.env.YOUTUBE_API_KEY === undefined || - process.env.YOUTUBE_API_KEY === '' || - process.env.DAILYMOTION_API_KEY === undefined || - process.env.DAILYMOTION_API_KEY === ''){ - console.log('Error Env YOUTUBE_API_KEY & DAILYMOTION_API_KEY Variables'); - process.exit(); -} - -console.log('Env variables YOUTUBE_API_KEY & DAILYMOTION_API_KEY received'); - -module.exports = { - youtube: { - name: "Youtube", - shortname: "yt", - baseAPIUrl: 'https://youtube.googleapis.com/youtube/v3', - baseChannelUrl: 'https://www.youtube.com/channel/', - YOUTUBE_API_KEY: process.env.YOUTUBE_API_KEY - }, - dailymotion: { - name: "Dailymotion", - shortname: "dm", - baseAPIUrl: 'https://api.dailymotion.com', - baseChannelUrl: 'https://www.dailymotion.com/', - DAILYMOTION_API_KEY: process.env.DAILYMOTION_API_KEY - } -}; diff --git a/app-backend/config/mongodb.config.js b/app-backend/config/mongodb.config.js deleted file mode 100644 index 2180acc..0000000 --- a/app-backend/config/mongodb.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - prodUrl: process.env.DATABASE, - devUrl: "mongodb://127.0.0.1:27017/polynotfound" -}; diff --git a/app-backend/config/response.config.js b/app-backend/config/response.config.js deleted file mode 100644 index dfca2db..0000000 --- a/app-backend/config/response.config.js +++ /dev/null @@ -1,9 +0,0 @@ -function sendMessage (res, successCode, data, token=null) { - res.status(200).json({ status: 'success', successCode: successCode, token: token, data: data }); -} - -function sendError (res, statusCode, errorCode, reason, token=null) { - res.status(statusCode).json({ status: 'error', errorCode: errorCode, token: token, reason: reason}); -} - -module.exports = { sendMessage, sendError }; diff --git a/app-backend/config/sessionJWT.config.js b/app-backend/config/sessionJWT.config.js deleted file mode 100644 index 7dbc86c..0000000 --- a/app-backend/config/sessionJWT.config.js +++ /dev/null @@ -1,109 +0,0 @@ -const sessionJWTConfig = require ('jsonwebtoken'); -require('dotenv').config({ path: './app-backend/.env' }); -const {sendError} = require ("./response.config"); - -if(process.env.JWTRS256_PRIVATE_KEY === undefined || process.env.JWTRS256_PUBLIC_KEY === undefined){ - console.log('Error Env JWTRS256_PRIVATE_KEY & JWTRS256_PUBLIC_KEY Variables'); - process.exit(); -} - -console.log('Env variables JWTRS256_PRIVATE_KEY & JWTRS256_PUBLIC_KEY received'); -const JWTRS256_PRIVATE_KEY = Buffer.from(process.env.JWTRS256_PRIVATE_KEY, 'base64').toString('utf-8'); -const JWTRS256_PUBLIC_KEY = Buffer.from(process.env.JWTRS256_PUBLIC_KEY, 'base64').toString('utf-8'); - - -function createSessionJWT (id, email, profileImageUrl, role) { - return sessionJWTConfig.sign( - { - id: id, - email: email, - profileImageUrl: profileImageUrl, - role: role, - midExp: Math.floor(Date.now() / 1000) + 1800 - }, - JWTRS256_PRIVATE_KEY, - { - algorithm: 'RS256', - expiresIn: '1h' - } - ); -} - -function createSessionCookie(req, res, payload) { - let jwtToken; - if (typeof payload.id !== 'undefined' && - typeof payload.email !== 'undefined' && - typeof payload.profileImageUrl !== 'undefined' && - typeof payload.role !== 'undefined' && - typeof payload.midExp !== 'undefined' && - (Math.floor(Date.now() / 1000) <= payload.midExp)) { - jwtToken = req.headers.cookie; - } - else { - jwtToken = createSessionJWT(payload.id, payload.email, payload.profileImageUrl, payload.role); - } - res.cookie('SESSIONID', jwtToken, {httpOnly:true, secure:false}); -} - -function decodeSessionCookie(sessionid) { - if (typeof sessionid === 'undefined') { - return {id: -1, email: -1, profileImageUrl: -1, role: -1}; - } - try { - const token = sessionJWTConfig.verify( - sessionid, - JWTRS256_PUBLIC_KEY, - {algorithms: ['RS256']}); - return {token: token}; - } - catch (err) { - return {id: -1, email: -1, profileImageUrl: -1, role: -1}; - } -} - -function getSession(sessionid) { - return decodeSessionCookie(sessionid); -} -module.exports.getSession = getSession - -function setSessionCookie (req, res, session) { - createSessionCookie(req, res, session); -} -module.exports.setSessionCookie = setSessionCookie; - -function getToken(session) { - if (typeof session === 'undefined' || typeof session.token === 'undefined') return -1; - return session.token; -} -module.exports.getToken = getToken; - -function checkLogin(req, res, role=null){ - if(typeof req.cookies !== 'undefined'){ - const session = getSession(req.cookies.SESSIONID); - const token = getToken(session); - if(typeof token.email === 'undefined' || - token.email === -1 || - typeof token.id === 'undefined' || - token.id === -1){ - return sendError(res, 500, 102, "User not authenticated."); - } else { - token.midExp = new Date(token.midExp*1000); - token.iat = new Date(token.iat*1000); - token.exp = new Date(token.exp*1000); - if(role === null){ - return token; - } else { - if(typeof token.role !== 'undefined' && - ((Array.isArray(role) && role.includes(token.role)) || - ( typeof role === 'object' && typeof token.role.permission !== 'undefined' && token.role.permission >= role.permission && token.role.isAccepted === true))){ - return token; - } else { - return sendError(res, 500, 106, "User doesn't have permission.", token); - } - } - } - } else { - return sendError(res, 500, -1, "Cookies don't exist."); - } -} -module.exports.checkLogin = checkLogin; diff --git a/app-backend/controllers/ad.controller.js b/app-backend/controllers/ad.controller.js deleted file mode 100644 index d92be1f..0000000 --- a/app-backend/controllers/ad.controller.js +++ /dev/null @@ -1,290 +0,0 @@ -const db = require("../models/mongodb.model"); -const {sendError, sendMessage} = require ("../config/response.config"); -const {checkLogin} = require("../config/sessionJWT.config"); -const ObjectId = require('mongoose').Types.ObjectId; -const roles = require("../models/objects/role.model"); -const Ad = db.ads; - -// Create a new Ad -exports.create = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token && req.body.title){ - Ad.exists({title: req.body.title, userId: token.id, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Ad already exists.", token); - } else{ - if(docs === null) { - let ad; - - ad = new Ad({ - userId: token.id, - title: req.body.title, - images: req.body.images ? req.body.images : undefined, - url: req.body.url ? req.body.url : undefined, - interests: req.body.interests ? req.body.interests : undefined, - comment: req.body.comment ? req.body.comment : undefined, - isVisible: req.body.isVisible ? req.body.isVisible : undefined, - isActive: req.body.isActive ? req.body.isActive : undefined - }); - - // Save User in the database - ad - .save(ad) - .then(data => { - return sendMessage(res, 41, data, token) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Ad.", token); - }); - } else{ - return sendError(res, 500, 104, err || `Ad ${req.body.title} already exists.`, token); - } - } - }); - } else { - return sendError(res, 500, -1, `No title given`, token); - } -}; - -// Retrieve all Ad from id if admin or session id -exports.findAll = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token){ - let query = {}; - let condition; - - const adId = req.query.adId; - condition = adId ? adId : undefined; - query._id = condition; - - let userId; - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - userId = req.query.userId; - } else { - userId = token.id; - } - condition = userId ? userId : undefined; - query.userId = condition; - - const title = req.query.title; - condition = title ? { $regex: new RegExp(title), $options: "i" } : undefined; - query.title = condition; - - const url = req.query.url; - condition = url ? { $regex: new RegExp(url), $options: "i" } : undefined; - query.url = condition; - - const interests = req.query.interests; - condition = interests ? {$in: interests.split(',')} : undefined; - query["interests.interest"] = condition - - const comment = req.query.comment; - condition = comment ? { $regex: new RegExp(comment), $options: "i" } : undefined; - query.comment = condition; - - const isVisible = req.query.isVisible; - condition = isVisible ? isVisible : undefined; - query.isVisible = condition; - - const isActive = req.query.isActive; - condition = isActive ? isActive : undefined; - query.isActive = condition; - - const sort = req.query.sort; - if(sort !== 'undefined'){ - switch (sort){ - case 'asc': - condition = {title: 1}; - break; - case 'desc': - condition = {title: -1}; - break; - case 'createdAtAsc': - condition = {createdAt: 1}; - break; - case 'createdAtDesc': - condition = {createdAt: -1}; - break; - case 'updatedAtAsc': - condition = {updatedAt: 1}; - break; - case 'updatedAtDesc': - condition = {updatedAt: -1}; - break; - default: - condition = {title: 1}; - } - } - const query_sort = {sort: condition}; - - // Remove undefined key - Object.keys(query).forEach(key => query[key] === undefined ? delete query[key] : {}); - console.log(query); - - Ad.find(query, {}, query_sort) - .then(data => { - if(data){ - return sendMessage(res, 42, data, token); - } - }) - .catch(err => { - return sendError(res,500,100,err.message || "Some error occurred while finding the Ads.", token); - }); - } -}; - -// Find single Ad from id if admin or session id -exports.findOne = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - Ad.findById(id, {}) - .then(data => { - if(data){ - return sendMessage(res, 43, data, token); - } else { - return sendError(res,404,105,`Ad not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res,500,100,err.message || `Some error occurred while finding the Ad with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Update a Ad with ad id -exports.update = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(typeof req.body._id !== 'undefined' || typeof req.body.id !== 'undefined'){ - return sendError(res, 500, -1, `User do not have the permission to modify id or _id`, token); - } else{ - let update = {}; - let condition; - - const title = req.body.title; - condition = title ? title : undefined; - update.title = condition; - - const images = req.body.images; - condition = images ? images : undefined; - update.images = condition; - - const url = req.body.url; - condition = url ? url : undefined; - update.url = condition; - - let interests = req.body.interests; - condition = interests ? {interests: [...new Map(interests.map(v => [v.id, v])).values()]} : undefined; - update.$addToSet = condition; - - const comment = req.body.comment; - condition = comment ? comment : undefined; - update.comment = condition; - - const isVisible = req.body.isVisible; - if(typeof isVisible !== 'undefined'){ - condition = isVisible; - } else{ - condition = undefined; - } - update.isVisible = condition; - - const isActive = req.body.isActive; - if(typeof isActive !== 'undefined'){ - condition = isActive; - } else{ - condition = undefined; - } - update.isActive = condition; - - // Remove undefined key - Object.keys(update).forEach(key => update[key] === undefined ? delete update[key] : {}); - - if(id && ObjectId.isValid(id)){ - Ad.updateOne({_id: id, userId: token.id}, update) - .then(data => { - if(data) { - //Object.keys(update).forEach(key => data[key] = update[key]); - return sendMessage(res, 44, update, token); - } else { - return sendError(res, 404, -1, `Ad not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, -1, err.message || `Some error occurred while updating the Ad with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete an Ad with ad id -exports.delete = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token && typeof req.params.id !== 'undefined') { - let match = null; - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - match = {_id: id, isActive: true}; - } else { - match = {_id: id, userId: token.id, isActive: true}; - } - Ad.findOneAndUpdate(match, {isActive: false}, {useFindAndModify: false, new: true}) - .then(data => { - if(data) { - if(data.isActive !== true){ - return sendMessage(res, 45, {message: `Ad ${id} was successfully deleted.`}, token); - } else { - return sendError(res, 404, 105, `Ad ${id} was not deleted.`, token); - } - } else { - return sendError(res, 404, 105, `Ad not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, 100, err.message || `Some error occurred while deleting the Ad with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete all Ad from session id -exports.deleteAll = (req, res) => { - const token = checkLogin(req, res, roles.Advertiser); - if(token) { - Ad.updateMany({userId: {$eq: token.id}, isActive: true}, {isActive: false}) - .then(data => { - return sendMessage(res, 46, { - message: `${data.modifiedCount} Ads were deleted successfully.` - }); - }) - .catch(err => { - return sendError(res, 500, -1, err.message || "Some error occurred while removing all Ads."); - }); - } -}; diff --git a/app-backend/controllers/misc.controller.js b/app-backend/controllers/misc.controller.js deleted file mode 100644 index 326e138..0000000 --- a/app-backend/controllers/misc.controller.js +++ /dev/null @@ -1,7 +0,0 @@ -const {sendMessage} = require ("../config/response.config"); -const interests = require("../models/objects/video.categories.model"); - -// Get all interests available -exports.getInterests = (req, res) => { - return sendMessage(res, 51, interests, null) -}; diff --git a/app-backend/controllers/playlist.controller.js b/app-backend/controllers/playlist.controller.js deleted file mode 100644 index 51442a1..0000000 --- a/app-backend/controllers/playlist.controller.js +++ /dev/null @@ -1,407 +0,0 @@ -const db = require("../models/mongodb.model"); -const {sendError, sendMessage} = require ("../config/response.config"); -const {checkLogin} = require("../config/sessionJWT.config"); -const {youtube, dailymotion} = require("../config/host.config"); -const {asyncRequest, asyncInterest} = require("../config/functions.config"); -const ObjectId = require('mongoose').Types.ObjectId; -const Playlist = db.playlists; -const Video = db.videos; - -// Create a new Playlist -exports.create = (req, res) => { - const token = checkLogin(req, res); - if(token && req.body.name){ - const video = req.body.video; - if(typeof video !== 'undefined' && - video !== null && - typeof video.videoId !== 'undefined' && - video.videoId !== null && - typeof video.source !== 'undefined' && - video.source !== null && - typeof video.interest !== 'undefined' && - video.interest !== null - ){ - Video.exists({userId: token.id, videoId: video.videoId, source: video.source, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Video already exists.", token); - } else{ - if(docs === null) { - let video; - - video = new Video({ - userId: token.id, - videoId: id, - source: req.body.source, - interest: req.body.interest, - watchedDates: [new Date()] - }); - - // Save Video in the database - video - .save(video) - .then(data => { - if(data) { - Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token); - } else{ - if(docs === null) { - let playlist; - - playlist = new Playlist({ - userId: token.id, - name: req.body.name, - videoIds: data._id ? [data._id] : undefined, - isActive: true - }); - - // Save User in the database - playlist - .save(playlist) - .then(data => { - return sendMessage(res, 21, data, token) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Playlist.", token); - }); - } else{ - return sendError(res, 500, 104, err || `Playlist ${req.body.name} already exists.`, token); - } - } - }); - } - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Video.", token); - }); - } else{ - const id = docs._id.toString(); - Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token); - } else{ - if(docs === null) { - let playlist; - - playlist = new Playlist({ - userId: token.id, - name: req.body.name, - videoIds: [id], - isActive: true - }); - - // Save User in the database - playlist - .save(playlist) - .then(data => { - return sendMessage(res, 21, data, token) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Playlist.", token); - }); - } else{ - return sendError(res, 500, 104, err || `Playlist ${req.body.name} already exists.`, token); - } - } - }); - } - } - }); - } else { - Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token); - } else{ - if(docs === null) { - let playlist; - - playlist = new Playlist({ - userId: token.id, - name: req.body.name, - videoIds: req.body.videoIds ? req.body.videoIds : undefined, - isActive: req.body.isActive ? req.body.isActive : undefined - }); - - // Save User in the database - playlist - .save(playlist) - .then(data => { - return sendMessage(res, 21, data, token) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Playlist.", token); - }); - } else{ - return sendError(res, 500, 104, err || `Playlist ${req.body.name} already exists.`, token); - } - } - }); - } - } -}; - -// Retrieve all Playlist from id if admin or session id -exports.findAll = (req, res) => { - const token = checkLogin(req, res); - if(token){ - let query = {}; - let condition; - - const playlistId = req.query.playlistId; - condition = playlistId ? playlistId : undefined; - query._id = condition; - - const userId = token.id; - condition = userId ? userId : undefined; - query.userId = condition; - - const videoIds = req.query.videoIds; - condition = videoIds ? {$in: videoIds} : undefined; - query.videoIds = condition; - - const name = req.query.name; - condition = name ? { $regex: new RegExp(name), $options: "i" } : undefined; - query.name = condition; - - const isActive = req.query.isActive; - condition = isActive ? isActive : undefined; - query.isActive = condition; - - const sort = req.query.sort; - if(sort !== 'undefined'){ - switch (sort){ - case 'asc': - condition = {name: 1}; - break; - case 'desc': - condition = {name: -1}; - break; - case 'createdAtAsc': - condition = {createdAt: 1}; - break; - case 'createdAtDesc': - condition = {createdAt: -1}; - break; - case 'updatedAtAsc': - condition = {updatedAt: 1}; - break; - case 'updatedAtDesc': - condition = {updatedAt: -1}; - break; - default: - condition = {name: 1}; - } - } - const query_sort = {sort: condition}; - - // Remove undefined key - Object.keys(query).forEach(key => query[key] === undefined ? delete query[key] : {}); - console.log(query); - - Playlist.find(query, {}, query_sort) - .then(data => { - return sendMessage(res, 22, data, token); - }) - .catch(err => { - return sendError(res,500,100,err.message || "Some error occurred while finding the Playlists.", token); - }); - } -}; - -// Find single Playlist from session id -exports.findOne = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - Playlist.aggregate([ - {$match: {_id: new ObjectId(id), userId: token.id, isActive: true}}, - {$unwind: '$videoIds'}, - {$project: { - userId: true, - name: true, - isActive: true, - createdAt: true, - updatedAt: true, - videoIds: {$toObjectId: '$videoIds'} - }}, - {$lookup: { - from: 'videos', - localField: 'videoIds', - foreignField: '_id', - as: 'videos' - }}, - {$unwind: '$videos'}, - {$group: { - _id: '$_id', - userId: {$first: "$userId"}, - name: {$first: "$name"}, - isActive: {$first: "$isActive"}, - createdAt: {$first: "$createdAt"}, - updatedAt: {$first: "$updatedAt"}, - videos: {$push: "$videos"} - }} - ]) - .then(async data => { - let yt_results = []; - let dm_results = []; - let yt_videoIds = ""; - let dm_videoIds = ""; - - for (const i in data[0].videos) { - if (data[0].videos[i].source === youtube.name) { - yt_videoIds = yt_videoIds + data[0].videos[i].videoId + ","; - } else if (data[0].videos[i].source === dailymotion.name) { - dm_videoIds = dm_videoIds + data[0].videos[i].videoId + ","; - } - } - if (yt_videoIds !== "") { - const uri = youtube.baseAPIUrl + '/videos' + '?part=snippet&part=statistics&id=' + yt_videoIds.slice(0, -1) + '&key=' + youtube.YOUTUBE_API_KEY; - const dataVideos = await asyncRequest(uri, {}); - if (dataVideos.response.statusCode === 200 && dataVideos.body.items.length > 0) { - yt_results = dataVideos.body.items; - } - } - - if (dm_videoIds !== "") { - const uri = dailymotion.baseAPIUrl + '/videos?ids=' + dm_videoIds.slice(0, -1) + '&fields=thumbnail_480_url%2Ctitle%2Cid'; - const data = await asyncRequest(uri, {}); - const response = data.response; - const jsonBody = data.body; - if (response.statusCode === 200) { - dm_results = jsonBody.list; - } - } - for (const i in data[0].videos) { - if (data[0].videos[i].source === youtube.name) { - const obj = yt_results.filter(obj => obj.id === data[0].videos[i].videoId); - data[0].videos[i].imageUrl = obj[0].snippet.thumbnails.medium.url ? obj[0].snippet.thumbnails.medium.url : null; - data[0].videos[i].interest = obj[0].snippet.categoryId ? await asyncInterest(obj[0].snippet.categoryId, youtube.name): null; - data[0].videos[i].title = obj[0].snippet.title ? obj[0].snippet.title : null; - data[0].videos[i].views = obj[0].statistics.viewCount ? parseInt(obj[0].statistics.viewCount) : null; - data[0].videos[i].publishedAt = obj[0].snippet.publishedAt ? obj[0].snippet.publishedAt : null; - } else if (data[0].videos[i].source === dailymotion.name) { - const obj = dm_results.filter(obj => obj.id === data[0].videos[i].videoId); - data[0].videos[i].imageUrl = obj[0].thumbnail_480_url ? obj[0].thumbnail_480_url : null; - data[0].videos[i].interest = obj[0]['channel.name'] ? await asyncInterest( obj[0]['channel.name'], dailymotion.name) : null; - data[0].videos[i].title = obj[0].title ? obj[0].title : null; - data[0].videos[i].views = obj[0].views_total ? parseInt(obj[0].views_total) : null; - data[0].videos[i].publishedAt = obj[0].created_time ? new Date(obj[0].created_time * 1000) : null - } - } - return sendMessage(res, 12, data[0], token) - }) - .catch(err => { - return sendError(res,500,100,err.message || `Some error occurred while finding the Playlist with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Update a Playlist with playlist id -exports.update = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(typeof req.body._id !== 'undefined' || typeof req.body.id !== 'undefined'){ - return sendError(res, 500, -1, `User do not have the permission to modify id or _id`, token); - } else{ - const ids = id.split(','); - let update = {}; - let condition; - - const name = req.body.name; - condition = name ? name : undefined; - update.name = condition; - - const videoIds = req.body.videoIds; - condition = videoIds ? videoIds : undefined; - update.videoIds = condition; - - const videoId = req.body.videoId; - if(typeof videoId !== 'undefined' && typeof videoId.id !== 'undefined' && typeof videoId.action !== 'undefined'){ - if(videoId.action === 'add'){ - condition = videoId.id ? {videoIds: videoId.id} : undefined; - update.$addToSet = condition; - } else if(videoId.action === 'delete'){ - condition = videoId.id ? {videoIds: videoId.id} : undefined; - update.$pull = condition; - } - } - - const isActive = req.body.isActive; - if(typeof isActive !== 'undefined'){ - condition = isActive; - } else{ - condition = undefined; - } - update.isActive = condition; - - // Remove undefined key - Object.keys(update).forEach(key => update[key] === undefined ? delete update[key] : {}); - - Playlist.updateMany({_id: {$in: ids}, userId: token.id, isActive: true}, update, {new: false}) - .then(data => { - if(data) { - if(data.modifiedCount > 0){ - return sendMessage(res, 24, update, token); - } else { - return sendError(res, 500, -1, `Video in Playlist ${data} already exists.`, token); - } - } else { - return sendError(res, 404, -1, `Playlist not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, -1, err.message || `Some error occurred while updating the Playlist with id=${id}`, token); - }); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete a Playlist with playlist id -exports.delete = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - Playlist.findByIdAndUpdate(id, {isActive: false}, {useFindAndModify: false}) - .then(data => { - if(data) { - return sendMessage(res, 25, {message: `Playlist ${id} was successfully deleted.`}, token); - } else { - return sendError(res, 404, 105, `Playlist not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, 100, err.message || `Some error occurred while deleting the Playlist with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete all Playlists from session id -exports.deleteAll = (req, res) => { - const token = checkLogin(req, res); - if(token) { - Playlist.updateMany({userId: {$eq: token.id}, isActive: true}, {isActive: false}) - .then(data => { - return sendMessage(res, 26, { - message: `${data.modifiedCount} Playlists were deleted successfully.` - }); - }) - .catch(err => { - return sendError(res, 500, -1, err.message || "Some error occurred while removing all Playlists."); - }); - } -}; diff --git a/app-backend/controllers/user.controller.js b/app-backend/controllers/user.controller.js deleted file mode 100644 index 098db1b..0000000 --- a/app-backend/controllers/user.controller.js +++ /dev/null @@ -1,546 +0,0 @@ -const db = require("../models/mongodb.model"); -const {sendError, sendMessage} = require ("../config/response.config"); -const {checkLogin, setSessionCookie} = require("../config/sessionJWT.config"); -const ObjectId = require('mongoose').Types.ObjectId; -const roles = require("../models/objects/role.model"); -const {youtube, dailymotion} = require("../config/host.config"); -const {asyncRequest} = require("../config/functions.config"); -const User = db.users; -const Video = db.videos; -const Ad = db.ads; - -// Authenticate a User -exports.auth = (req, res) => { - // Validate request - if (!req.body.email || !req.body.hashPass) { - sendError(res, 400,-1,"Content can not be empty . (email and hashPass needed)"); - } else{ - // Check User in the database - User - .findOne({email: req.body.email, hashPass: req.body.hashPass, isActive: true, "role.isAccepted": true}, {role: true, profileImageUrl: true}) - .then(data => { - if (data !== null){ - User.findByIdAndUpdate(data._id.toString(), {lastConnexion: new Date()}, {useFindAndModify: false}, - function (err) { - if (err){ - return sendError(res, 400, 100,err.message || "Some error occurred while updating the User."); - } - else{ - const dataRes = {id: data._id.toString(), email: req.body.email, profileImageUrl: data.profileImageUrl, role: data.role}; - setSessionCookie(req, res, dataRes); - return sendMessage(res, 1, dataRes); - } - }); - } else { - setSessionCookie(req, res, {id: -1, email: -1, profileImageUrl: -1, role: -1}); - return sendError(res, 500, 101, "Invalid login or password."); - } - }) - .catch(err => { - return sendError(res, 400, 100,err.message || "Some error occurred while authenticating the User."); - }); - } -}; - -// Logout a User -exports.logout = (req, res) => { - const token = checkLogin(req, res); - if(token){ - setSessionCookie(req, res, {id: -1, email: -1, profileImageUrl: -1, role: -1}); - return sendMessage(res, 2, {message: "User disconnected"}); - } -}; - -// Request password reset with email -exports.resetPass = (req, res) => { - return sendError(res, 501, -1, "User.resetPass not Implemented", null); -}; - -// Create and Save a new User -exports.create = (req, res) => { - // Validate request - if (!req.body.email || !req.body.hashPass || !req.body.login) { - sendError(res, 400,-1,"Content can not be empty . (email, hashPass and login needed"); - } - else{ - User.exists({email: req.body.email}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the User already exists."); - } else{ - if(docs === null) { - let user; - let var_role; - if(typeof req.body.role !== 'undefined'){ - switch(req.body.role){ - case 'admin': - var_role = roles.Admin; - break; - case 'advertiser': - var_role = roles.Advertiser; - break; - default: - var_role = roles.User; - } - } else{ - var_role = roles.User; - } - - user = new User({ - email: req.body.email, - hashPass: req.body.hashPass, - login: req.body.login, - role: var_role, - company: req.body.company ? req.body.company : null, - dateOfBirth: req.body.dateOfBirth ? req.body.dateOfBirth : null, - gender: req.body.gender ? req.body.gender : null, - interests: req.body.interests ? req.body.interests : null, - }); - - // Save User in the database - user - .save(user) - .then(data => { - data.hashPass = undefined; // Hiding hashPass on return - return sendMessage(res, 4, data) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the User."); - }); - } else{ - return sendError(res, 500, 104, err || `Email ${req.body.email} already exists.`); - } - } - }); - } -}; - -// Retrieve all Users from the database if at least admin. -exports.findAll = (req, res) => { - const token = checkLogin(req, res, roles.Admin); - if(token){ - let query = {}; - let condition; - - const ids = req.query.userId; - condition = ids ? {$in: ids} : undefined; - query._id = condition; - - const email = req.query.email; - condition = email ? { $regex: new RegExp(email), $options: "i" } : undefined; - query.email = condition; - - const login = req.query.login; - condition = login ? { $regex: new RegExp(login), $options: "i" } : undefined; - query.login = condition; - - const role = req.query.role; - condition = role ? role : undefined; - query["role.name"] = condition; - - const company = req.query.company; - condition = company ? { $regex: new RegExp(company), $options: "i" } : undefined; - query.company = condition; - - const dateOfBirth = req.query.dateOfBirth; - condition = dateOfBirth ? new Date(dateOfBirth) : undefined; - query.dateOfBirth = condition; - - const gender = req.query.gender; - condition = gender ? gender : undefined; - query.gender = condition; - - const isActive = req.query.isActive; - condition = isActive ? isActive : undefined; - query.isActive = condition; - - const isAccepted = req.query.isAccepted; - if(isAccepted !== 'undefined'){ - switch (isAccepted){ - case 'true': - condition = true; - break; - case 'false': - condition = false; - break; - } - } - query["role.isAccepted"] = condition; - - const sort = req.query.sort; - if(sort !== 'undefined'){ - switch (sort){ - case 'asc': - condition = {email: 1}; - break; - case 'desc': - condition = {email: -1}; - break; - case 'lastConnexionAsc': - condition = {lastConnexion: 1}; - break; - case 'lastConnexionDesc': - condition = {lastConnexion: -1}; - break; - case 'createdAtAsc': - condition = {createdAt: 1}; - break; - case 'createdAtDesc': - condition = {createdAt: -1}; - break; - case 'updatedAtAsc': - condition = {updatedAt: 1}; - break; - case 'updatedAtDesc': - condition = {updatedAt: -1}; - break; - default: - condition = {email: 1}; - } - } - const query_sort = {sort: condition}; - - // Remove undefined key - Object.keys(query).forEach(key => query[key] === undefined ? delete query[key] : {}); - console.log(query); - - User.find(query, {hashPass: false}, query_sort) - .then(data => { - return sendMessage(res, 5, data, token); - }) - .catch(err => { - return sendError(res,500,100,err.message || "Some error occurred while retrieving users.", token); - }); - } -}; - -// Find a single User by session id -exports.findOne = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - let id = null; - if(typeof token.id !== 'undefined' && token.id === req.params.id){ - id = req.params.id; - } else { - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - id = req.params.id; - } else { - return sendError(res, 500, 106, `User do not have the permission.`, token); - } - } - if(id && ObjectId.isValid(id)){ - User.findById(id, {hashPass: false}) - .then(data => { - if(data){ - return sendMessage(res, 6, data, token); - } else { - return sendError(res,404,105,`User not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res,500,100,err.message || `Some error occurred while finding the User with id=${id}`, token); - }); - } else { - sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Update a User by the id in the request -exports.update = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - let id = null; - if(typeof token.id !== 'undefined' && token.id === req.params.id){ - id = req.params.id; - } else { - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - id = req.params.id; - } else { - return sendError(res, 500, 106, `User do not have the permission.`, token); - } - } - if(id && ObjectId.isValid(id)){ - let update = null; - if(typeof req.body._id !== 'undefined' || typeof req.body.id !== 'undefined'){ - return sendError(res, 500, -1, `User do not have the permission to modify id or _id`, token); - } else{ - if(typeof req.body.role !== 'undefined' || - typeof req.body.isActive !== 'undefined' || - typeof req.body.lastConnexion !== 'undefined' || - typeof req.body.createdAt !== 'undefined'|| - typeof req.body.updatedAt !== 'undefined'){ - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - update = true; - } else{ - return sendError(res, 500, 106, `User do not have the permission to modify these keys.`, token); - } - } else{ - update = true; - } - } - if(update === true){ - User.findByIdAndUpdate(id, req.body, {useFindAndModify: false}) - .then(data => { - if(data) { - data.hashPass = undefined; - Object.keys(req.body).forEach(key => data[key] = req.body[key]); - sendMessage(res, 7, data, token); - } else { - sendError(res, 404, -1, `User not found with id=${id}`, token); - } - }) - .catch(err => { - sendError(res, 500, -1, err.message || `Some error occurred while updating the User with id=${id}`, token); - }); - } - } else { - sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - - - -// Delete a User with the specified id in the request -exports.delete = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - let id = null; - if(typeof token.id !== 'undefined' && token.id === req.params.id){ - id = req.params.id; - } else { - if(typeof token.role !== 'undefined' && - typeof token.role.permission !== 'undefined' && - typeof token.role.isAccepted !== 'undefined' && - token.role.isAccepted === true && - token.role.permission >= roles.Admin.permission) { - id = req.params.id; - } else { - return sendError(res, 500, 106, `User do not have the permission.`, token); - } - } - if(id && ObjectId.isValid(id)){ - User.findByIdAndUpdate(id, {isActive: false}, {useFindAndModify: false}) - .then(data => { - if(data) { - return sendMessage(res, 8, {message: `User ${id} was successfully deleted.`}, token); - } else { - return sendError(res, 404, 105, `User not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, 100, err.message || `Some error occurred while deleting the User with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete all Users from the database except superAdmin -exports.deleteAll = (req, res) => { - const token = checkLogin(req, res, roles.SuperAdmin); - if(token) { - User.deleteMany({login: {$ne: "superAdmin"}}) - .then(data => { - return sendMessage(res, 9, { - message: `${data.deletedCount} Users were deleted successfully.` - }); - }) - .catch(err => { - return sendError(res, 500, 100, err.message || "Some error occurred while removing all Users."); - }); - } -}; - -// Get all Roles depending on the role of the User -exports.roles = (req, res) => { - const token = checkLogin(req, res); - if(token){ - return sendMessage(res, 10, roles, token); - } -}; - -// Get 1 or multiple ad adapted to the User session id -exports.ad = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.query.quantity !== 'undefined'){ - const id = token.id; - const quantity = req.query.quantity; - // Interests from the user and from last 20 videos viewed if no ad matches -> find x ad from these interests + add date view to the ad - let interests = []; - const maxInterests = 20; - let limit = maxInterests; - User.findById(id, {_id: false, interests: true}) - .then(data => { - if(typeof data.interests !== 'undefined' && data.interests !== null){ - interests = interests.concat(data.interests); - limit = maxInterests-data.interests.length; - } - Video.aggregate([ - {$match: {userId: id}}, - {$project: {_id: false, interest: true}}, - {$sort: {watchedDates: -1}}, - {$limit: limit}, - {$unwind: '$interest'}, - {$group: {_id: null, interests: {$push: '$interest'}}} - ]) - .then(data => { - if(typeof data[0] !== 'undefined' && - typeof data[0].interests !== 'undefined' && - data[0].interests !== [] && - data[0].interests !== null){ - interests = interests.concat(data[0].interests); - } - let match, pick; - if(interests.length > 0){ - match = {$match: {isVisible: true, isActive: true, interests: {$elemMatch: {interest: {$in: interests}}}}}; - pick = {$limit: parseInt(quantity, 10)} - } else { - match = {$match: {isVisible: true, isActive: true}}; - pick = {$sample: {size: parseInt(quantity, 10)}}; - } - - Ad.aggregate([ - match, - pick - ]) - .then(data => { - if(data.length > 0){ - let ids = [] - for(const i in data){ids.push(data[i]._id);} - Ad.updateMany({_id: {$in: ids}}, {$push: {views: [new Date()]}}) - .then(dataUpdate => { - if(dataUpdate && dataUpdate.modifiedCount > 0){ - return sendMessage(res, 11, data, token); - } else { - return sendError(res,500,101,`Some error occurred while updating ${quantity} ad(s) for the User.`, token); - } - }) - .catch(err => { - return sendError(res,500,101,err.message || `Some error occurred while updating ${quantity} ad(s) for the User.`, token); - }); - } else { - Ad.aggregate([{$match: {isVisible: true, isActive: true}}, {$sample: {size: parseInt(quantity, 10)}}]) - .then(data => { - let ids = [] - for(const i in data){ids.push(data[i]._id);} - Ad.updateMany({_id: {$in: ids}}, {$push: {views: [new Date()]}}) - .then(dataUpdate => { - if(dataUpdate && dataUpdate.modifiedCount > 0){ - return sendMessage(res, 11, data, token); - } else { - return sendError(res,500,101,`Some error occurred while updating ${quantity} ad(s) for the User.`, token); - } - }) - .catch(err => { - return sendError(res,500,101,err.message || `Some error occurred while updating ${quantity} ad(s) for the User.`, token); - }); - }) - .catch(err => { - return sendError(res,500,101,err.message || `Some error occurred while getting ${quantity} ad(s) for the User.`, token); - }); - } - }) - .catch(err => { - return sendError(res,500,101,err.message || `Some error occurred while getting ${quantity} ad(s) for the User.`, token); - }); - }) - .catch(err => { - return sendError(res,500,102,err.message || `Some error occurred while getting ${quantity} ad(s) for the User.`, token); - }); - }) - .catch(err => { - return sendError(res,500,100,err.message || `Some error occurred while getting ${quantity} ad(s) for the User.`, token); - }); - } else { - sendError(res, 500, -1, `No quantity given`, token); - } -}; - -// Get History -exports.history = (req, res) => { - const token = checkLogin(req, res); - if(token){ - const id = token.id; - - Video.aggregate([ - {$match: {userId: id, $expr: {$gt: [{$size: "$watchedDates"}, 0]}}}, - {$limit: 300}, - {$project: { - videoId: true, - source: true, - tags: true, - interest: true, - views: {$size: '$watchedDates'}, - watchedDate: {$arrayElemAt: ["$watchedDates", -1]}, - createdAt: true, - updatedAt: true - }}, - {$sort: {watchedDate: -1}}]) - .then(async data => { - let yt_results = []; - let dm_results = []; - let yt_videoIds = ""; - let dm_videoIds = ""; - - for(const i in data) { - if(data[i].source === youtube.name) { - yt_videoIds = yt_videoIds + data[i].videoId + ","; - } else if (data[i].source === dailymotion.name) { - dm_videoIds = dm_videoIds + data[i].videoId + ","; - } - } - if(yt_videoIds !== ""){ - const uri = youtube.baseAPIUrl + '/videos' + '?part=snippet&part=statistics&id=' + yt_videoIds.slice(0, -1) + '&key=' + youtube.YOUTUBE_API_KEY; - const dataVideos = await asyncRequest(uri, {}); - if (dataVideos.response.statusCode === 200 && dataVideos.body.items.length > 0) { - yt_results = dataVideos.body.items; - } - } - - if(dm_videoIds !== ""){ - const uri = dailymotion.baseAPIUrl + '/videos?ids='+dm_videoIds.slice(0, -1)+'&fields=thumbnail_480_url%2Ctitle%2Cid'; - const data = await asyncRequest(uri, {}); - const response = data.response; - const jsonBody = data.body; - if(response.statusCode === 200){ - dm_results = jsonBody.list; - } - } - for(const i in data) { - if(data[i].source === youtube.name) { - const obj = yt_results.filter(obj => obj.id === data[i].videoId); - data[i].imageUrl = obj[0].snippet.thumbnails.medium.url ? obj[0].snippet.thumbnails.medium.url : null; - data[i].title = obj[0].snippet.title ? obj[0].snippet.title : null; - } else if (data[i].source === dailymotion.name) { - const obj = dm_results.filter(obj => obj.id === data[i].videoId); - data[i].imageUrl = obj[0].thumbnail_480_url ? obj[0].thumbnail_480_url : null; - data[i].title = obj[0].title ? obj[0].title : null; - } - } - return sendMessage(res, 12, data, token) - }) - .catch(err => { - return sendError(res,500,100,err.message || "Some error occurred while getting the User history.", token); - }); - } -}; diff --git a/app-backend/controllers/video.controller.js b/app-backend/controllers/video.controller.js deleted file mode 100644 index f928918..0000000 --- a/app-backend/controllers/video.controller.js +++ /dev/null @@ -1,473 +0,0 @@ -const db = require("../models/mongodb.model"); -const request = require('request'); -const {sendError, sendMessage} = require ("../config/response.config"); -const {checkLogin} = require("../config/sessionJWT.config"); -const {youtube, dailymotion} = require("../config/host.config"); -const {asyncRequest, asyncInterest} = require("../config/functions.config"); -const ObjectId = require('mongoose').Types.ObjectId; -const Video = db.videos; - - -// Search Videos -exports.search = async (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.query.q !== 'undefined'){ - const query = req.query.q; - const maxResults = req.query.maxResults ? req.query.maxResults : 45; - const pageToken = req.query.pageToken ? req.query.pageToken : undefined; - let sources; - if(typeof req.query.sources !== 'undefined' && req.query.sources !== ''){ - sources = req.query.sources.split(','); - } else { - sources = ["yt", "dm"]; - } - let yt_results = []; - let dm_results = []; - for(const i in sources){ - if(sources[i] === youtube.shortname){ - if(youtube.YOUTUBE_API_KEY !== 'undefined' && youtube.YOUTUBE_API_KEY !== ''){ - let uri; - if(query !== ''){ - if(typeof pageToken !== 'undefined'){ - uri = youtube.baseAPIUrl+'/search'+'?part=snippet&maxResults='+maxResults+'&q='+query+'&pageToken='+pageToken+'&key='+youtube.YOUTUBE_API_KEY; - } else{ - uri = youtube.baseAPIUrl+'/search'+'?part=snippet&maxResults='+maxResults+'&q='+query+'&key='+youtube.YOUTUBE_API_KEY; - } - const dataIds = await asyncRequest(uri, {}); - if(dataIds.response.statusCode === 200 && dataIds.body.items.length > 0){ - let yt_videoIds = ""; - dataIds.body.items.forEach(item => yt_videoIds = yt_videoIds+item.id.videoId+","); - uri = youtube.baseAPIUrl+'/videos'+'?part=snippet&part=statistics&id='+yt_videoIds.slice(0, -1)+'&key='+youtube.YOUTUBE_API_KEY; - const dataVideos = await asyncRequest(uri, {}); - if(dataVideos.response.statusCode === 200 && dataVideos.body.items.length > 0){ - yt_results = dataVideos.body.items; - } - } - } else { - uri = youtube.baseAPIUrl+'/videos'+'?part=snippet&part=statistics&chart=mostPopular&maxResults='+maxResults+'&key='+youtube.YOUTUBE_API_KEY; - const dataVideos = await asyncRequest(uri, {}); - if(dataVideos.response.statusCode === 200 && dataVideos.body.items.length > 0){ - yt_results = dataVideos.body.items; - } - } - } else{ - return sendError(res, 500, -1, `Error Env Variable DAILYMOTION_API_KEY missing, please contact the admin.`, token); - } - } else if(sources[i] === dailymotion.shortname){ - if(dailymotion.DAILYMOTION_API_KEY !== 'undefined' && dailymotion.DAILYMOTION_API_KEY !== '') { - let uri; - if(query !== ''){ - uri = dailymotion.baseAPIUrl + '/videos?limit='+maxResults+'&search='+query+'&fields=created_time%2Cdescription%2Cthumbnail_480_url%2Clikes_total%2Ctitle%2Cid%2Cembed_url%2Cviews_total%2Cowner.username%2Cowner.id%2Cchannel.name'; - } else { - uri = dailymotion.baseAPIUrl + '/videos?limit='+maxResults+'&sort=trending&fields=created_time%2Cdescription%2Cthumbnail_480_url%2Clikes_total%2Ctitle%2Cid%2Cembed_url%2Cviews_total%2Cowner.username%2Cowner.id%2Cchannel.name'; - } - const data = await asyncRequest(uri, {}); - const response = data.response; - const jsonBody = data.body; - if(response.statusCode === 200){ - dm_results = jsonBody.list; - } - } else{ - return sendError(res, 500, -1, `Error Env Variable DAILYMOTION_API_KEY missing, please contact the admin.`, token); - } - } - } - - let results = []; - for(let i = 0; i < Math.max(dm_results.length, yt_results.length); i++){ - - // Youtube - if(yt_results.length > i){ - const yt_data = { - videoId: yt_results[i].id, - source: youtube.name, - imageUrl: yt_results[i].snippet.thumbnails.medium.url ? yt_results[i].snippet.thumbnails.medium.url : null, - title: yt_results[i].snippet.title ? yt_results[i].snippet.title : null, - channelTitle: yt_results[i].snippet.channelTitle ? yt_results[i].snippet.channelTitle : null, - channelUrl: youtube.baseChannelUrl+yt_results[i].snippet.channelId ? yt_results[i].snippet.channelId : null, - description: yt_results[i].snippet.description ? yt_results[i].snippet.description : null, - embedUrl: 'https://www.youtube.com/embed/'+yt_results[i].id, - interest: await asyncInterest(yt_results[i].snippet.categoryId, youtube.name), - views: yt_results[i].statistics.viewCount ? parseInt(yt_results[i].statistics.viewCount) : null, - likes: yt_results[i].statistics.likeCount ? parseInt(yt_results[i].statistics.likeCount) : null, - dislikes: yt_results[i].statistics.dislikeCount ? parseInt(yt_results[i].statistics.dislikeCount) : null, - publishedAt: yt_results[i].snippet.publishedAt ? yt_results[i].snippet.publishedAt : null - }; - results.push(yt_data); - } - - // Dailymotion - if(dm_results.length > i) { - const channelTitle = dm_results[i]['owner.username'] ? dm_results[i]['owner.username'] : null; - const dm_data = { - videoId: dm_results[i].id ? dm_results[i].id : null, - source: dailymotion.name, - imageUrl: dm_results[i].thumbnail_480_url ? dm_results[i].thumbnail_480_url : null, - title: dm_results[i].title ? dm_results[i].title : null, - channelTitle: channelTitle.charAt(0).toUpperCase() + channelTitle.slice(1), - channelUrl: dailymotion.baseChannelUrl + channelTitle, - description: dm_results[i].description ? dm_results[i].description : null, - embedUrl: dm_results[i].embed_url ? dm_results[i].embed_url : null, - interest: await asyncInterest(dm_results[i]['channel.name'], dailymotion.name), - views: dm_results[i].views_total ? parseInt(dm_results[i].views_total) : null, - likes: dm_results[i].likes_total ? parseInt(dm_results[i].likes_total) : null, - dislikes: null, - publishedAt: dm_results[i].created_time ? new Date(dm_results[i].created_time * 1000) : null - }; - results.push(dm_data); - } - } - return sendMessage(res, 31, results, token); - } else{ - return sendError(res, 500, -1, `No q given`, token); - } -}; - -// Get Video with id of source -exports.get = (req, res) => { - if(typeof req.query.source !== 'undefined' && typeof req.params.id !== 'undefined'){ - const source = req.query.source; - const id = req.params.id; - if(source === youtube.shortname){ - if(youtube.YOUTUBE_API_KEY !== 'undefined' && youtube.YOUTUBE_API_KEY !== ''){ - const uri = youtube.baseAPIUrl+'/videos'+'?part=snippet&part=statistics&id='+id+'&key='+youtube.YOUTUBE_API_KEY; - request(uri,{},async function (error, response, body){ - if(typeof body !== 'undefined'){ - const jsonBody = JSON.parse(body); - if(jsonBody.items.length !== 0 && - typeof jsonBody.items[0] !== 'undefined' && - typeof jsonBody.items[0].id !== 'undefined' && - jsonBody.items[0].id === id){ - const imageUrl = jsonBody.items[0].snippet.thumbnails.standard.url ? jsonBody.items[0].snippet.thumbnails.standard.url : null; - const title = jsonBody.items[0].snippet.title ? jsonBody.items[0].snippet.title : null; - const channelId = jsonBody.items[0].snippet.channelId ? jsonBody.items[0].snippet.channelId : null; - const channelTitle = jsonBody.items[0].snippet.channelTitle ? jsonBody.items[0].snippet.channelTitle : null; - const description = jsonBody.items[0].snippet.description ? jsonBody.items[0].snippet.description : null; - //const embedUrl = jsonBody.embed_url ? jsonBody.embed_url : null; - const publishedAt = jsonBody.items[0].snippet.publishedAt ? jsonBody.items[0].snippet.publishedAt : null; - const interest = jsonBody.items[0].snippet.categoryId ? await asyncInterest(jsonBody.items[0].snippet.categoryId, youtube.name): null; - const views = jsonBody.items[0].statistics.viewCount ? parseInt(jsonBody.items[0].statistics.viewCount) : null; - const likes = jsonBody.items[0].statistics.likeCount ? parseInt(jsonBody.items[0].statistics.likeCount) : null; - const dislikes = jsonBody.items[0].statistics.dislikeCount ? parseInt(jsonBody.items[0].statistics.dislikeCount) : null; - const data = { - videoId: id, - source: youtube.name, - imageUrl: imageUrl, - title: title, - channelTitle: channelTitle, - channelUrl: youtube.baseChannelUrl+channelId, - description: description, - embedUrl: 'https://www.youtube.com/embed/'+id, - interest: interest, - views: views, - likes: likes, - dislikes: dislikes, - publishedAt: publishedAt - }; - return sendMessage(res, 32, data); - } else{ - return sendError(res, 404, -1, `No result`); - } - } else{ - return sendError(res, 500, -1, error); - } - }); - } else{ - return sendError(res, 500, -1, `Error Env Variable YOUTUBE_API_KEY missing, please contact the admin.`); - } - } else if(source === dailymotion.shortname){ - if(dailymotion.DAILYMOTION_API_KEY !== 'undefined' && dailymotion.DAILYMOTION_API_KEY !== ''){ - const uri = dailymotion.baseAPIUrl+'/video/'+id+'?fields=created_time%2Cdescription%2Cthumbnail_480_url%2Clikes_total%2Ctitle%2Cid%2Cembed_url%2Cviews_total%2Cowner.username%2Cowner.id%2Cchannel.name'; - request(uri,{},async function (error, response, body) { - if (typeof body !== 'undefined') { - const jsonBody = JSON.parse(body); - if(response.statusCode === 200 && - typeof jsonBody.id !== 'undefined' && - jsonBody.id === id){ - const imageUrl = jsonBody.thumbnail_480_url ? jsonBody.thumbnail_480_url : null; - const title = jsonBody.title ? jsonBody.title : null; - //const channelId = jsonBody['owner.id'] ? jsonBody['owner.id'] : null; - const channelTitle = jsonBody['owner.username'] ? jsonBody['owner.username'] : null; - const description = jsonBody.description ? jsonBody.description : null; - const embedUrl = jsonBody.embed_url ? jsonBody.embed_url : null; - const publishedAt = jsonBody.created_time ? new Date(jsonBody.created_time * 1000) : null; - const interest = jsonBody['channel.name'] ? await asyncInterest(jsonBody['channel.name'], dailymotion.name) : null; - const views = jsonBody.views_total ? parseInt(jsonBody.views_total) : null; - const likes = jsonBody.likes_total ? parseInt(jsonBody.likes_total) : null; - const dislikes = null; - const data = { - videoId: id, - source: dailymotion.name, - imageUrl: imageUrl, - title: title, - channelTitle: channelTitle.charAt(0).toUpperCase() + channelTitle.slice(1), - channelUrl: dailymotion.baseChannelUrl+channelTitle, - description: description, - embedUrl: embedUrl, - interest: interest, - views: views, - likes: likes, - dislikes: dislikes, - publishedAt: publishedAt - }; - return sendMessage(res, 32, data); - } else{ - return sendError(res, 404, -1, jsonBody.error.message); - } - } - }); - } else{ - return sendError(res, 500, -1, `Error Env Variable DAILYMOTION_API_KEY missing, please contact the admin.`); - } - } else{ - return sendError(res, 500, -1, `Wrong source name`); - } - } else{ - return sendError(res, 500, -1, `No source or/and id given`); - } -}; - -// Create a new Video -exports.create = (req, res) => { - const token = checkLogin(req, res); - if(token && - typeof req.body.source !== 'undefined' && - typeof req.body.interest !== 'undefined' && - typeof req.params.id !== 'undefined'){ - const id = req.params.id; - Video.exists({userId: token.id, videoId: id, source: req.body.source, isActive: true}, function (err, docs){ - if(err){ - sendError(res, 500,100,err.message || "Some error occurred while checking if the Video already exists.", token); - } else{ - if(docs === null) { - let video; - - video = new Video({ - userId: token.id, - videoId: id, - source: req.body.source, - interest: req.body.interest, - watchedDates: [new Date()] - }); - - // Save Video in the database - video - .save(video) - .then(data => { - return sendMessage(res, 33, data, token) - }) - .catch(err => { - return sendError(res, 500,100,err.message || "Some error occurred while creating the Video.", token); - }); - } else{ - const id = docs._id.toString(); - Video.findByIdAndUpdate(id, {$push: {watchedDates: [new Date()]}}, {useFindAndModify: false, new: true}) - .then(data => { - if(data) { - return sendMessage(res, 33, data, token); - } else { - return sendError(res, 404, 105, `Video not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, 100, err.message || `Some error occurred while updating the Video with id=${id}`, token); - }); - } - } - }); - } else { - return sendError(res, 500, -1, `No source or interest or id given`, token); - } -}; - -// Retrieve all Videos -exports.findAll = (req, res) => { - const token = checkLogin(req, res); - if(token){ - let query = {}; - let condition; - - const userId = req.query.userId; - condition = userId ? userId : undefined; - query.userId = condition; - - const videoId = req.query.videoId; - condition = videoId ? videoId : undefined; - query.videoId = condition; - - const source = req.query.source; - condition = source ? source : undefined; - query.source = condition; - - const interests = req.query.interests; - condition = interests ? {$in: interests} : undefined; - query["interests.interest"] = condition - - const isActive = req.query.isActive; - condition = isActive ? isActive : undefined; - query.isActive = condition; - - const sort = req.query.sort; - if(sort !== 'undefined'){ - switch (sort){ - case 'asc': - condition = {videoId: 1}; - break; - case 'desc': - condition = {videoId: -1}; - break; - case 'createdAtAsc': - condition = {createdAt: 1}; - break; - case 'createdAtDesc': - condition = {createdAt: -1}; - break; - case 'updatedAtAsc': - condition = {updatedAt: 1}; - break; - case 'updatedAtDesc': - condition = {updatedAt: -1}; - break; - default: - condition = {createdAt: -1}; - } - } - const query_sort = {sort: condition}; - - // Remove undefined key - Object.keys(query).forEach(key => query[key] === undefined ? delete query[key] : {}); - console.log(query); - - Video.find(query, {}, query_sort) - .then(data => { - return sendMessage(res, 34, data, token); - }) - .catch(err => { - return sendError(res,500,100,err.message || "Some error occurred while finding the Videos.", token); - }); - } -}; - -// Find single Video with id -exports.findOne = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - Video.findById(id, {}) - .then(data => { - if(data){ - return sendMessage(res, 35, data, token); - } else { - return sendError(res,404,105,`Video not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res,500,100,err.message || `Some error occurred while finding the Video with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Update Video with id -exports.update = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(typeof req.body._id !== 'undefined' || typeof req.body.id !== 'undefined'){ - return sendError(res, 500, -1, `User do not have the permission to modify id or _id`, token); - } else{ - let update = {}; - let condition; - - const watchedDate = req.body.watchedDate; - if(typeof watchedDate !== 'undefined'){ - if(watchedDate){ - condition = {watchedDates: [new Date()]} - } else { - condition = undefined; - } - } else{ - condition = undefined; - } - update.$push = condition; - - const watchedDates = req.body.watchedDates ? req.body.watchedDates : undefined; - update.watchedDates = watchedDates; - - const isActive = req.body.isActive; - if(typeof isActive !== 'undefined'){ - condition = isActive; - } else{ - condition = undefined; - } - update.isActive = condition; - - // Remove undefined key - Object.keys(update).forEach(key => update[key] === undefined ? delete update[key] : {}); - - if(id && ObjectId.isValid(id)){ - Video.updateOne({_id: id, userId: token.id, isActive: true}, update) - .then(data => { - if(data) { - return sendMessage(res, 36, update, token); - } else { - return sendError(res, 404, -1, `Video not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, -1, err.message || `Some error occurred while updating the Video with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete Video with id -exports.delete = (req, res) => { - const token = checkLogin(req, res); - if(token && typeof req.params.id !== 'undefined') { - const id = req.params.id; - if(id && ObjectId.isValid(id)){ - Video.updateOne({_id: id, userId: token.id, isActive: true}, {isActive: false}, {useFindAndModify: false}) - .then(data => { - if(data.modifiedCount > 0) { - return sendMessage(res, 37, {message: `Video ${id} was successfully deleted.`}, token); - } else { - return sendError(res, 404, 105, `Video not found with id=${id}`, token); - } - }) - .catch(err => { - return sendError(res, 500, 100, err.message || `Some error occurred while deleting the Video with id=${id}`, token); - }); - } else { - return sendError(res, 500, -1, `Error id is not valid`, token); - } - } else { - return sendError(res, 500, -1, `No id given`, token); - } -}; - -// Delete all Videos -exports.deleteAll = (req, res) => { - const token = checkLogin(req, res); - if(token) { - Video.updateMany({userId: {$eq: token.id}, isActive: true}, {isActive: false}) - .then(data => { - return sendMessage(res, 38, { - message: `${data.modifiedCount} Videos were deleted successfully.`, - }); - }) - .catch(err => { - return sendError(res, 500, 100, err.message || "Some error occurred while removing all Videos."); - }); - } -}; diff --git a/app-backend/jwtRS256.key b/app-backend/jwtRS256.key deleted file mode 100644 index be25b1d..0000000 --- a/app-backend/jwtRS256.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJJwIBAAKCAgEAlt1zgyBeUIHeCYz4vbxEdqtupPjwy7hqL2iFbGGoJUudbvw4 -LpRFmE0iw4cCuRGHwkO8vbqhCEJwpu7v5v/sYr3wOAioksr/PdHvbpKHMgLBUdnx -n2fGBiNn6vdKMddAjqYoGBvgIhER+A5YXQ96IrVcvlu3ZJKfXx0alTZh8bsWV7PL -rkf4j9brG66ymYdjg3VMfltQoLnV+MsubJp8WVSP7MnqJ09js2Kg7/FpvhZDhk1o -/ky4ZZ3V6gpwVl16jApBpn6DRqpnOx1i67P19remDrFgCnKMpdHU9cg4zK7NqMVo -Q5ZD1R/w6hu+y8UIpWFBQoby7GuAoUGmzAWvHrDDLJfAAnrYJmhDu7YOew5M+bAO -BfVC3jO0gCO7Eu1TAbdkoBwvlFErorGlZxGRm79BlOmd590Ri+JvLHcek9KG3Yo4 -2M171QfYOK+167SJ+yGmIXadCENAEun7ocoNPZm4SMkJC2BfS9k00j83FhVPbE/v -z0x8iGlCDQRxO/ML2YvT47bHiXpbDXz/iXE6m1YIVhabUW6xLt4LaHxSJ5hf5/4p -OF7YCxfgFssL4QQKIxsac3eEOyMpUhudVXhH3TBaKipzUdmtY99zhP+u4cKnqAUV -k3Esd15IJ3q3eOWd+s4sugTqZQ0eeHlvnRScTF0Fskrxt5uxbmrAHJ/JlgcCAwEA -AQKCAgAkcCZXNHkzLrrHScJGaXOLygo2VF4shkU3YCJhtBCduW60AL09GtjYWUEd -Qr24n3BPznaGyM3eJdX5q9pLy+J3UvLzRbwZgGg3sT4IUeHPhXTV5TMD0le04dZW -nRXRhfD0w1MJx6nR8JeLd0OGbpeMTIuy+ooIA5X0rh3ejj0H2q0hz65RUNbLPxiY -HhDLHjU96hXoqvuFZn000zZKSuHf3ZnJklc42Wb2S8sdSQzGObBjfszuJu+es4mY -Np89bOSNcGi84u+oIL5AO+/JiDTPOzojcFoHC/XGkzDBkHOPlGTd75goQuHtVwKk -OMFTjCpzb1MI03lW+vwddrLnsjPCcfY76v+5ASryMh5LFvIOaAXYrPaHU9vcaytJ -hmyiVvviPf0VbpwBqkI3MPajoFNk8uScrRQe6frhHyOgmQLIpijaZ44PV9pZYED8 -EVULn0VQzyidF2T6JMU1/Zq6/Bk29uhqUPLof42jhi/jqCX0uJAnyqOHO2ZzMF5d -xI55xFHJ+f3Zac5TacyOGA+7fsziyVWKXe73wk8RBgIbUiK0x273zvykIKJ1W19M -2ihfr8fBjLgPpfeUont2cDX90hJUkEJhsi0PwQhfZS9WtH0Z88pBjO1OZsIfRdZP -Y542RH1U1vl730CQTHl6YcqsEHV1rL0nxsBmBMjRA277xrqd0QKCAQEAxL7tjbXe -IKAy3TvXBdLzRpZjWF/6NDCvpHicfjujx7/6yxyaIg5KbWNzRI4RTuAetPuPP1V0 -7ygAR49RZTkZxzSG0JjpzkXoPjydTBDqIazJ0X1tS7ltnVMil6wiX8vm2DnlAB/S -fki5JK9x+jY/YrRIbkGp1LNMOG57pxRn3vQoJl4X1lmjTgqLiJR8lOlS/Ur07b6s -yzsBinuWTtPrB5eCHFdn7nQPoHzUdbJHO/DOs0fmp1mbQ/IbFs4vSUay/KetBjDE -4YbUyBRd6J7KIFEy2SlCeg1eyCQGK2cbghlBX7ljdWQmYaSK8QHlDRkbJaYw1q2P -9Hi+HZhXR0YxuQKCAQEAxE0ff5b1fDsZYvJU4CZ73AWxjF4hlM2KMcJ37H53tVjq -EpsQadxz2qFMZ60Nvk9lSzLMsXePgVChIXgL5s5GMesInqxbIUaQJ+fnwJaMYU+6 -OYrilV64IqUSC36Arecsm39faYk+y4I34Zqtn6iJeuiifGaVZr66uuKS820wq92g -rVnsjSjWZw4F1Zh0X9hZRqteKPQZRcqT6Nnrb48Ko0GcC7MyeXAYjEGZi9EGBiWh -xM5zzzmK1H3TrJyXopbmIxauKy+Uvzhbu8XiaCP2LJy5JKGoN39CYLZ5fD+gtHhU -oycRyCNzv512QPngBc5L+qm27FB/nUcePYhNn3DlvwKCAQAqu/nnTPiJh6JksWm8 -Bxz2WRYNDRPQoD6Wb+g19whVC9sSoQzNluMNrYtM+brCsiWZVAbCT/KNO9gLsxKP -9P4nab5assweFMskMZBNBGOGmvxfN2o1B3rKsFMUNLxmqGhk0PZvt3nGGk+0qzML -kRrlepk88aBM5gEJRN4w5VrGb6wE4W02DtRM0DeMnAwPYDq5b72Rolfv8Mod5Ug5 -qQgk5wDI3SdjAOygBF01j1qvp1eOU3DDKtBxyrWdl31n4iZggJ8xeAhboCi5qMrZ -CxyGNnzf9HlO/3Z17HU2mje8Y3Xyr9btmapIjS/st2ekF67w149GIf7hsBRDY2KZ -xaJpAoIBABg5zGFaqAEk6gUkEwV2umJ08Wx5UXujwiJR9ariELP4vSp+qI/n/QRG -U7+Xw9Jwyfd11X0xXCyBXuFah118p30RnIa4jqaUpsXGAPvrmHeJ91mSolP81Iyy -AoAYpJjRptep6ISFw5IqB+t3w2Wozw60FxlzL4z2jOTzgV85YoBTYbkDGAZzu8IM -IPwzTGlnsdze2UgEl/nc/lQGUN/7rzxmpHNtMhV6mAz3K5Ptv+iSTFyVfgVc/J0s -yirLSItwRAagje4WeS0AL5IE4eQoTAFFdjPnH3N56R82ZdfHonWjRA6+i5s/hNFp -BWcPb25H/2h3+XNAm/80/65oW+wJatECggEAfsCp+hf3lwV5RbI155z+7aAG8vsh -09r4Dw3VjtaKfhZBqk0LsiqHr8J+v49Fo0Q5nJzMEyqIN47jrLuKcqV8f43CIIuP -Rq3QpulJIisbSfhth4gJRhjpFzYAc+JLUftCNJXAii/yr0fFUg+O3XUwwwsdbDK5 -QV2N0lCRGyN1WUVH/Zm7NPeaLDz4xv4YWtz7Yj8bepbKgD8gHV4UCuApULbEwSQp -uUPksMHLIz+1DKhZVgu+/ldz1sCV7Tomj/MMONQh0jgdfpOILfSad7M/f3rHtuDt -DQHiWGLseNypmBZtaFDz1P+NkkFeSBlabbEpVOoTCUwTjIqfXPNyj/zTTQ== ------END RSA PRIVATE KEY----- diff --git a/app-backend/jwtRS256.key.pub b/app-backend/jwtRS256.key.pub deleted file mode 100644 index d89cfa5..0000000 --- a/app-backend/jwtRS256.key.pub +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlt1zgyBeUIHeCYz4vbxE -dqtupPjwy7hqL2iFbGGoJUudbvw4LpRFmE0iw4cCuRGHwkO8vbqhCEJwpu7v5v/s -Yr3wOAioksr/PdHvbpKHMgLBUdnxn2fGBiNn6vdKMddAjqYoGBvgIhER+A5YXQ96 -IrVcvlu3ZJKfXx0alTZh8bsWV7PLrkf4j9brG66ymYdjg3VMfltQoLnV+MsubJp8 -WVSP7MnqJ09js2Kg7/FpvhZDhk1o/ky4ZZ3V6gpwVl16jApBpn6DRqpnOx1i67P1 -9remDrFgCnKMpdHU9cg4zK7NqMVoQ5ZD1R/w6hu+y8UIpWFBQoby7GuAoUGmzAWv -HrDDLJfAAnrYJmhDu7YOew5M+bAOBfVC3jO0gCO7Eu1TAbdkoBwvlFErorGlZxGR -m79BlOmd590Ri+JvLHcek9KG3Yo42M171QfYOK+167SJ+yGmIXadCENAEun7ocoN -PZm4SMkJC2BfS9k00j83FhVPbE/vz0x8iGlCDQRxO/ML2YvT47bHiXpbDXz/iXE6 -m1YIVhabUW6xLt4LaHxSJ5hf5/4pOF7YCxfgFssL4QQKIxsac3eEOyMpUhudVXhH -3TBaKipzUdmtY99zhP+u4cKnqAUVk3Esd15IJ3q3eOWd+s4sugTqZQ0eeHlvnRSc -TF0Fskrxt5uxbmrAHJ/JlgcCAwEAAQ== ------END PUBLIC KEY----- diff --git a/app-backend/jwtRS256.sh b/app-backend/jwtRS256.sh deleted file mode 100755 index 64ecaff..0000000 --- a/app-backend/jwtRS256.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key -q -N "" -openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub -#rm .env -echo "JWTRS256_PRIVATE_KEY='`cat ./jwtRS256.key | base64 -w 0`'" >> .env -echo "JWTRS256_PUBLIC_KEY='`cat ./jwtRS256.key.pub | base64 -w 0`'" >> .env -source .env -rm jwtRS256.key diff --git a/app-backend/models/database/ads.model.js b/app-backend/models/database/ads.model.js deleted file mode 100644 index 2389c44..0000000 --- a/app-backend/models/database/ads.model.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = mongoose => { - let schema = mongoose.Schema({ - userId: String, - title: String, - images: { - type: Array, - default: [] - }, - url: { - type: String, - default: null - }, - interests: { - type: Array, - default: [] - }, - comment: { - type: String, - default: null - }, - views: { - type: Array, - default: [] - }, - isVisible: { - type: Boolean, - default: true - }, - isActive: { - type: Boolean, - default: true - } - }, - { timestamps: true } - ); - - schema.method("toJSON", function() { - const { __v, _id, ...object } = this.toObject(); - object.id = _id; - return object; - }); - - return mongoose.model("ads", schema); -}; diff --git a/app-backend/models/database/playlists.model.js b/app-backend/models/database/playlists.model.js deleted file mode 100644 index ad065a5..0000000 --- a/app-backend/models/database/playlists.model.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = mongoose => { - let schema = mongoose.Schema({ - userId: String, - videoIds: { - type: Array, - default: [] - }, - name: String, - isActive: { - type: Boolean, - default: true - } - }, - { timestamps: true } - ); - - schema.method("toJSON", function() { - const { __v, _id, ...object } = this.toObject(); - object.id = _id; - return object; - }); - - return mongoose.model("playlists", schema); -}; diff --git a/app-backend/models/database/users.model.js b/app-backend/models/database/users.model.js deleted file mode 100644 index 9467b3c..0000000 --- a/app-backend/models/database/users.model.js +++ /dev/null @@ -1,48 +0,0 @@ -const roles = require("../objects/role.model"); - -module.exports = mongoose => { - let schema = mongoose.Schema({ - email: String, - hashPass: String, // WARNING: We don't want to send back the hashPass - login: String, - role: { - type: Object, - default: roles.User - }, - company: String, - profileImageUrl: { - type: String, - default: "https://www.handiclubnimois.fr/wp-content/uploads/2020/10/blank-profile-picture-973460_1280.png" - }, - dateOfBirth: { - type: Date, - default: null - }, - gender: { - type: String, - default: null - }, - interests: { - type: Array, - default: null - }, - isActive: { - type: Boolean, - default: true - }, - lastConnexion: { - type: Date, - default: null - } - }, - { timestamps: true } - ); - - schema.method("toJSON", function() { - const { __v, _id, ...object } = this.toObject(); - object.id = _id; - return object; - }); - - return mongoose.model("users", schema); -}; diff --git a/app-backend/models/database/videos.model.js b/app-backend/models/database/videos.model.js deleted file mode 100644 index 4d322da..0000000 --- a/app-backend/models/database/videos.model.js +++ /dev/null @@ -1,29 +0,0 @@ -module.exports = mongoose => { - let schema = mongoose.Schema({ - userId: String, - videoId: String, - source: String, - interest: { - type: String, - default: null - }, - watchedDates: { - type: Array, - default: null - }, - isActive: { - type: Boolean, - default: true - } - }, - { timestamps: true } - ); - - schema.method("toJSON", function() { - const { __v, _id, ...object } = this.toObject(); - object.id = _id; - return object; - }); - - return mongoose.model("videos", schema); -}; diff --git a/app-backend/models/mongodb.model.js b/app-backend/models/mongodb.model.js deleted file mode 100644 index 9ddb7cd..0000000 --- a/app-backend/models/mongodb.model.js +++ /dev/null @@ -1,19 +0,0 @@ -const dbConfig = require("../config/mongodb.config"); -const mongoose = require("mongoose"); -mongoose.Promise = global.Promise; - -const db = {}; -db.mongoose = mongoose; - -if(typeof process.env.NODE_ENV !== 'undefined' && process.env.NODE_ENV === 'production'){ - db.url = dbConfig.prodUrl; -} else { - db.url = dbConfig.devUrl; -} - -db.users = require("./database/users.model")(mongoose); -db.playlists = require("./database/playlists.model")(mongoose); -db.videos = require("./database/videos.model")(mongoose); -db.ads = require("./database/ads.model")(mongoose); - -module.exports = db; diff --git a/app-backend/models/objects/image.model.js b/app-backend/models/objects/image.model.js deleted file mode 100644 index 72ec783..0000000 --- a/app-backend/models/objects/image.model.js +++ /dev/null @@ -1,10 +0,0 @@ -class Image { - constructor(base64, url, description, type){ - this.base64 = base64; - this.url = url; - this.description = description; - this.type = type; - } -} - -module.exports = Image; diff --git a/app-backend/models/objects/role.model.js b/app-backend/models/objects/role.model.js deleted file mode 100644 index 2e1703c..0000000 --- a/app-backend/models/objects/role.model.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - User: { - name: "user", - permission: 0, - isAccepted: true - }, - Advertiser: { - name: "advertiser", - permission: 5, - isAccepted: false - }, - Admin: { - name: "admin", - permission: 10, - isAccepted: false - }, - SuperAdmin: { - name: "superAdmin", - permission: 1000, - isAccepted: true - } -}; diff --git a/app-backend/models/objects/video.categories.model.js b/app-backend/models/objects/video.categories.model.js deleted file mode 100644 index 6eaab33..0000000 --- a/app-backend/models/objects/video.categories.model.js +++ /dev/null @@ -1,157 +0,0 @@ -const {youtube, dailymotion} = require('../../config/host.config'); -module.exports = [ - { - id: 0, - interest: "Actualités", - categories: [ - {id: "news", name: "News", source: dailymotion.name}, - {id: "25", name: "News & Politics", source: youtube.name}, - ] - }, - { - id: 1, - interest: "Animaux", - categories: [ - {id: "animals", name: "animaux", source: dailymotion.name}, - {id: "15", name: "Pets & Animals", source: youtube.name}, - ] - }, - { - id: 2, - interest: "Arts", - categories: [ - {id: "creation", name: "Art", source: dailymotion.name}, - {id: "", name: "", source: youtube.name}, - ] - }, - { - id: 3, - interest: "Autos", - categories: [ - {id: "auto", name: "Auto-Moto", source: dailymotion.name}, - {id: "2", name: "Autos & Vehicles", source: youtube.name}, - ] - }, - { - id: 4, - interest: "Divertissements", - categories: [ - {id: "tv", name: "TV", source: dailymotion.name}, - {id: "fun", name: "Humour & Divertissement", source: dailymotion.name}, - {id: "webcam", name: "Webcam", source: dailymotion.name}, - {id: "23", name: "Comedy", source: youtube.name}, - {id: "24", name: "Entertainment", source: youtube.name}, - {id: "43", name: "Shows", source: youtube.name} - ] - }, - { - id: 5, - interest: "Éducation", - categories: [ - {id: "school", name: "Éducation", source: dailymotion.name}, - {id: "27", name: "Education", source: youtube.name} - ] - }, - { - id: 6, - interest: "Événements", - categories: [ - {id: "", name: "", source: dailymotion.name}, - {id: "19", name: "Travel & Events", source: youtube.name}, - ] - }, - { - id: 7, - interest: "Films", - categories: [ - {id: "shortfilms", name: "Cinéma", source: dailymotion.name}, - {id: "1", name: "Film & Animation", source: youtube.name}, - {id: "18", name: "Short Movies", source: youtube.name}, - {id: "30", name: "Movies", source: youtube.name}, - {id: "31", name: "Anime/Animation", source: youtube.name}, - {id: "32", name: "Action/Adventure", source: youtube.name}, - {id: "33", name: "Comedy", source: youtube.name}, - {id: "35", name: "Documentary", source: youtube.name}, - {id: "36", name: "Drama", source: youtube.name}, - {id: "39", name: "Horror", source: youtube.name}, - {id: "40", name: "Sci-Fi/Fantasy", source: youtube.name}, - {id: "41", name: "Thriller", source: youtube.name}, - {id: "42", name: "Shorts", source: youtube.name}, - {id: "44", name: "Trailers", source: youtube.name} - ] - }, - { - id: 8, - interest: "Jeux vidéo", - categories: [ - {id: "videogames", name: "Jeux vidéo", source: dailymotion.name}, - {id: "20", name: "Gaming", source: youtube.name}, - ] - }, - { - id: 9, - interest: "Kids", - categories: [ - {id: "kids", name: "Kids", source: dailymotion.name}, - {id: "", name: "", source: youtube.name}, - ] - }, - { - id: 10, - interest: "Modes de vie", - categories: [ - {id: "lifestyle", name: "Lifestyle & Tutoriels", source: dailymotion.name}, - {id: "26", name: "Howto & Style", source: youtube.name}, - ] - }, - { - id: 11, - interest: "Musiques", - categories: [ - {id: "music", name: "Musique", source: dailymotion.name}, - {id: "10", name: "Music", source: youtube.name}, - ] - }, - { - id: 12, - interest: "People", - categories: [ - {id: "people", name: "Amis & Famille", source: dailymotion.name}, - {id: "21", name: "Videoblogging", source: youtube.name}, - {id: "22", name: "People & Blogs", source: youtube.name}, - {id: "37", name: "Family", source: youtube.name}, - ] - }, - { - id: 13, - interest: "Science et Technologie", - categories: [ - {id: "tech", name: "Tech", source: dailymotion.name}, - {id: "28", name: "Science & Technology", source: youtube.name}, - ] - }, - { - id: 14, - interest: "Sports", - categories: [ - {id: "sport", name: "Sport", source: dailymotion.name}, - {id: "17", name: "Sports", source: youtube.name}, - ] - }, - { - id: 15, - interest: "Voyages", - categories: [ - {id: "travel", name: "Voyages", source: dailymotion.name}, - {id: "38", name: "Foreign", source: youtube.name}, - ] - }, - { - id: 16, - interest: "Autres", - categories: [ - {id: "29", name: "Nonprofits & Activism", source: youtube.name}, - {id: "33", name: "Classics", source: youtube.name} - ] - } -]; diff --git a/app-backend/routes/ad.routes.js b/app-backend/routes/ad.routes.js deleted file mode 100644 index 738892b..0000000 --- a/app-backend/routes/ad.routes.js +++ /dev/null @@ -1,24 +0,0 @@ -const ads = require("../controllers/ad.controller"); -module.exports = app => { - let router = require("express").Router(); - - // Create a new Ad - router.post("/ad/create", ads.create); - - // Retrieve all Ad from id if admin or session id - router.get("/ad/findAll", ads.findAll); - - // Find single Ad from id if admin or session id - router.get("/ad/findOne/:id", ads.findOne); - - // Update a Ad with ad id - router.put("/ad/update/:id", ads.update); - - // Delete a Ad with ad id - router.delete("/ad/delete/:id", ads.delete); - - // Delete all Ad from id if admin or session id - router.delete("/ad/deleteAll", ads.deleteAll); - - app.use('/api', router); -}; diff --git a/app-backend/routes/misc.routes.js b/app-backend/routes/misc.routes.js deleted file mode 100644 index 7aa5be6..0000000 --- a/app-backend/routes/misc.routes.js +++ /dev/null @@ -1,9 +0,0 @@ -const misc = require("../controllers/misc.controller"); -module.exports = app => { - let router = require("express").Router(); - - // Get all interests available - router.get("/misc/getInterests", misc.getInterests); - - app.use('/api', router); -}; diff --git a/app-backend/routes/playlist.routes.js b/app-backend/routes/playlist.routes.js deleted file mode 100644 index 3b9beeb..0000000 --- a/app-backend/routes/playlist.routes.js +++ /dev/null @@ -1,24 +0,0 @@ -const playlists = require("../controllers/playlist.controller"); -module.exports = app => { - let router = require("express").Router(); - - // Create a new Playlist - router.post("/playlist/create", playlists.create); - - // Retrieve all Playlist from id if admin or session id - router.get("/playlist/findAll", playlists.findAll); - - // Find single Playlist from id if admin or session id - router.get("/playlist/findOne/:id", playlists.findOne); - - // Update a Playlist with playlist id - router.put("/playlist/update/:id", playlists.update); - - // Delete a Playlist with playlist id - router.delete("/playlist/delete/:id", playlists.delete); - - // Delete all Playlists from id if admin or session id - router.delete("/playlist/deleteAll", playlists.deleteAll); - - app.use('/api', router); -}; diff --git a/app-backend/routes/user.routes.js b/app-backend/routes/user.routes.js deleted file mode 100644 index 346cb04..0000000 --- a/app-backend/routes/user.routes.js +++ /dev/null @@ -1,42 +0,0 @@ -const users = require("../controllers/user.controller"); -module.exports = app => { - let router = require("express").Router(); - - // Authenticate a User - router.post("/user/auth", users.auth); - - // Logout a User - router.delete("/user/logout", users.logout); - - // Request password reset with email - router.post("/user/resetPass", users.resetPass); - - // Create and Save a new User - router.post("/user/create", users.create); - - // Retrieve all Users if admin - router.get("/user/findAll", users.findAll); - - // Find single User from id if admin or session id - router.get("/user/findOne/:id", users.findOne); - - // Update a User from id if admin or session id - router.put("/user/update/:id", users.update); - - // Delete a User from id if admin or session id - router.delete("/user/delete/:id", users.delete); - - // Delete all Users if superAdmin - router.delete("/user/deleteAll", users.deleteAll); - - // Get all Roles depending on the User session id - router.get("/user/roles", users.roles); - - // Get 1 or multiple ad adapted to the User session id - router.get("/user/ad", users.ad); - - // Get History - router.get("/user/history", users.history); - - app.use('/api', router); -}; diff --git a/app-backend/routes/video.routes.js b/app-backend/routes/video.routes.js deleted file mode 100644 index a07de28..0000000 --- a/app-backend/routes/video.routes.js +++ /dev/null @@ -1,30 +0,0 @@ -const videos = require("../controllers/video.controller"); -module.exports = app => { - let router = require("express").Router(); - - // Search Videos - router.get("/video/search", videos.search); - - // Get Video with id of source - router.get("/video/get/:id", videos.get); - - // Create a new Video - router.post("/video/create/:id", videos.create); - - // Retrieve all Videos - router.get("/video/findAll", videos.findAll); - - // Find single Video with id - router.get("/video/findOne/:id", videos.findOne); - - // Update Video with id - router.put("/video/update/:id", videos.update); - - // Delete Video with id - router.delete("/video/delete/:id", videos.delete); - - // Delete all Videos - router.delete("/video/deleteAll", videos.deleteAll); - - app.use('/api', router); -}; diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index ee31835..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: '3.8' - -services: - frontend: - container_name: frontend - build: . - command: ng serve --host 0.0.0.0 - volumes: - - ./src:/data/frontend/ - - ./node_modules:/data/frontend/node_modules - ports: - - 4200:4200 - depends_on: - - backend - links: - - backend - - backend: - container_name: backend - build: ./backend - command: node server.js - volumes: - - ./backend:/data/backend - - ./backend/node_modules:/data/backend/node_modules - - ./backend/app:/data/backend/app - ports: - - 3000:3000 - depends_on: - - mongodb - links: - - mongodb - environment: - NODE_ENV: development - - mongodb: - image: mongo - container_name: mongodb - volumes: - - ./backend/database:/data/db - ports: - - 27017:27017 diff --git a/admin/karma.conf.js b/karma.conf.js similarity index 98% rename from admin/karma.conf.js rename to karma.conf.js index 2023ed1..2c2c9f1 100644 --- a/admin/karma.conf.js +++ b/karma.conf.js @@ -3,7 +3,7 @@ module.exports = function (config) { config.set({ - basePath: '', + basePath: 'admin', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), diff --git a/package.json b/package.json index 1aacb0a..9b475ea 100644 --- a/package.json +++ b/package.json @@ -1,67 +1,44 @@ { - "name": "frontend", - "version": "1.0.0", + "name": "admin", + "version": "0.0.0", "scripts": { "ng": "ng", "start": "node server.js", - "dev": "ng serve", - "build": "ng build --configuration production", - "test": "ng test", - "lint": "ng lint", - "e2e": "ng e2e" + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test" }, "private": true, "dependencies": { - "@angular/animations": "^12.2.11", - "@angular/cdk": "^12.2.11", - "@angular/cli": "~12.2.11", - "@angular/common": "^12.2.11", - "@angular/compiler": "^12.2.11", - "@angular/compiler-cli": "~12.2.11", - "@angular/core": "^12.2.11", - "@angular/forms": "^12.2.11", - "@angular/material": "^12.2.11", - "@angular/platform-browser": "^12.2.11", - "@angular/platform-browser-dynamic": "^12.2.11", - "@angular/router": "^12.2.11", - "@ng-bootstrap/ng-bootstrap": "^10.0.0", - "angular-responsive-carousel": "^2.1.2", - "body-parser": "^1.19.0", + "@angular/animations": "~12.2.0", + "@angular/cdk": "^13.1.1", + "@angular/common": "~12.2.0", + "@angular/compiler": "~12.2.0", + "@angular/core": "~12.2.0", + "@angular/forms": "~12.2.0", + "@angular/material": "^13.1.1", + "@angular/platform-browser": "~12.2.0", + "@angular/platform-browser-dynamic": "~12.2.0", + "@angular/router": "~12.2.0", "bootstrap": "^5.1.3", - "chart.js": "^2.9.3", - "cookie-parser": "^1.4.5", - "cors": "^2.8.5", - "dotenv": "^10.0.0", - "express": "^4.17.1", "jquery": "^3.6.0", - "jsonwebtoken": "^8.5.1", - "mongoose": "^6.0.12", - "ng2-charts": "^2.2.3", "popper": "^1.0.1", - "request": "^2.88.2", "rxjs": "~6.6.0", - "tslib": "^2.0.0", - "typescript": "~4.3.5", - "zone.js": "~0.11.3" + "tslib": "^2.3.0", + "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-devkit/build-angular": "~12.2.11", - "@angular/cli": "~12.2.11", - "@angular/compiler-cli": "~12.2.11", - "@angular/localize": "^12.2.11", - "@types/jasmine": "~3.6.0", + "@angular-devkit/build-angular": "~12.2.10", + "@angular/cli": "~12.2.10", + "@angular/compiler-cli": "~12.2.0", + "@types/jasmine": "~3.8.0", "@types/node": "^12.11.1", - "codelyzer": "^6.0.0", - "jasmine-core": "~3.6.0", - "jasmine-spec-reporter": "~5.0.0", - "karma": "~6.3.5", + "jasmine-core": "~3.8.0", + "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", - "protractor": "~7.0.0", - "ts-node": "~8.3.0", - "tslint": "~6.1.0", + "karma-jasmine-html-reporter": "~1.7.0", "typescript": "~4.3.5" } } diff --git a/server.js b/server.js index 91f4105..533ce01 100644 --- a/server.js +++ b/server.js @@ -3,77 +3,6 @@ const express = require('express'); const app = express(); const port = process.env.PORT || 3000; -const cookieParser = require('cookie-parser'); -app.use(cookieParser()); - -const bodyParser = require('body-parser'); -app.use(bodyParser.urlencoded({extended:true})); -app.use(bodyParser.json()); - -const cors = require('cors'); -app.use(cors({origin: 'http://127.0.0.1:4200', credentials: true})); - -const db = require("./app-backend/models/mongodb.model"); -console.log("Db Url: ",db.url); -db.mongoose - .connect(db.url, { - useNewUrlParser: true, - useUnifiedTopology: true - }, function (err){ - const admin = new db.mongoose.mongo.Admin(db.mongoose.connection.db); - admin.buildInfo(function (err, info) { - console.log("MongoDB Version: "+info.version); - }); - if(err){ - console.log("Cannot connect to the database!", err); - process.exit(); - } else{ - console.log("Connected to the database!", db.url); - } - }); - -require("./app-backend/routes/user.routes")(app); -require("./app-backend/routes/playlist.routes")(app); -require("./app-backend/routes/video.routes")(app); -require("./app-backend/routes/ad.routes")(app); -require("./app-backend/routes/misc.routes")(app); - -const roles = require("./app-backend/models/objects/role.model"); -const User = db.users; -const login = 'superAdmin'; -const hashPass = 'hashPassSuperAdmin'; -const mail = 'superAdmin@email.admin'; - -User.exists({role: roles.SuperAdmin}, function (err, docs){ - if(err){ - console.log("Some error occurred while checking if superAdmin already exists."); - } else{ - if(docs === null){ - const user = new User({ - login: login, - hashPass: hashPass, - email: mail, - role: roles.SuperAdmin - }); - user - .save(user) - .then(data => { - data.hashPass = undefined; // Hiding hashPass on return - console.log(data); - }) - .catch(err => { - console.log(err.message || "Some error occurred while creating superAdmin."); - }); - } else { - console.log("superAdmin already exist !"); - } - } -}); - -app.get('/*all', function(req,res) { - res.sendFile(path.join(__dirname+ '/dist/index.html')); -}); - app.use(express.static(__dirname + '/dist/frontend')); app.get('/*', function(req,res) { res.sendFile(path.join(__dirname+ '/dist/frontend/index.html')); diff --git a/admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html similarity index 100% rename from admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html rename to src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html diff --git a/admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.scss b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.scss similarity index 100% rename from admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.scss rename to src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.scss diff --git a/admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.spec.ts b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.spec.ts rename to src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.spec.ts diff --git a/admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.ts b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.ts similarity index 100% rename from admin/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.ts rename to src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.ts diff --git a/admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.html b/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.html similarity index 100% rename from admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.html rename to src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.html diff --git a/admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.scss b/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.scss similarity index 100% rename from admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.scss rename to src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.scss diff --git a/admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.spec.ts b/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.spec.ts rename to src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.spec.ts diff --git a/admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.ts b/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.ts similarity index 100% rename from admin/src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.ts rename to src/app/admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component.ts diff --git a/admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.html b/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.html similarity index 100% rename from admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.html rename to src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.html diff --git a/admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.scss b/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.scss similarity index 100% rename from admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.scss rename to src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.scss diff --git a/admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.spec.ts b/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.spec.ts rename to src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.spec.ts diff --git a/admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.ts b/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.ts similarity index 100% rename from admin/src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.ts rename to src/app/admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component.ts diff --git a/admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html similarity index 100% rename from admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html rename to src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html diff --git a/admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.scss b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.scss similarity index 100% rename from admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.scss rename to src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.scss diff --git a/admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.spec.ts b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.spec.ts rename to src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.spec.ts diff --git a/admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.ts b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.ts similarity index 100% rename from admin/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.ts rename to src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.ts diff --git a/admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.html b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.html similarity index 100% rename from admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.html rename to src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.html diff --git a/admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.scss b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.scss similarity index 100% rename from admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.scss rename to src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.scss diff --git a/admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.spec.ts b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.spec.ts rename to src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.spec.ts diff --git a/admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts similarity index 100% rename from admin/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts rename to src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts diff --git a/admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.html b/src/app/admin/userList/input-interests-admin/input-interests-admin.component.html similarity index 100% rename from admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.html rename to src/app/admin/userList/input-interests-admin/input-interests-admin.component.html diff --git a/admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.scss b/src/app/admin/userList/input-interests-admin/input-interests-admin.component.scss similarity index 100% rename from admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.scss rename to src/app/admin/userList/input-interests-admin/input-interests-admin.component.scss diff --git a/admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.spec.ts b/src/app/admin/userList/input-interests-admin/input-interests-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.spec.ts rename to src/app/admin/userList/input-interests-admin/input-interests-admin.component.spec.ts diff --git a/admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.ts b/src/app/admin/userList/input-interests-admin/input-interests-admin.component.ts similarity index 100% rename from admin/src/app/admin/userList/input-interests-admin/input-interests-admin.component.ts rename to src/app/admin/userList/input-interests-admin/input-interests-admin.component.ts diff --git a/admin/src/app/admin/userList/page-user-list/page-user-list.component.html b/src/app/admin/userList/page-user-list/page-user-list.component.html similarity index 100% rename from admin/src/app/admin/userList/page-user-list/page-user-list.component.html rename to src/app/admin/userList/page-user-list/page-user-list.component.html diff --git a/admin/src/app/admin/userList/page-user-list/page-user-list.component.scss b/src/app/admin/userList/page-user-list/page-user-list.component.scss similarity index 100% rename from admin/src/app/admin/userList/page-user-list/page-user-list.component.scss rename to src/app/admin/userList/page-user-list/page-user-list.component.scss diff --git a/admin/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts b/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts similarity index 100% rename from admin/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts rename to src/app/admin/userList/page-user-list/page-user-list.component.spec.ts diff --git a/admin/src/app/admin/userList/page-user-list/page-user-list.component.ts b/src/app/admin/userList/page-user-list/page-user-list.component.ts similarity index 100% rename from admin/src/app/admin/userList/page-user-list/page-user-list.component.ts rename to src/app/admin/userList/page-user-list/page-user-list.component.ts diff --git a/admin/src/app/admin/userList/popup-create-user/popup-create-user.component.html b/src/app/admin/userList/popup-create-user/popup-create-user.component.html similarity index 100% rename from admin/src/app/admin/userList/popup-create-user/popup-create-user.component.html rename to src/app/admin/userList/popup-create-user/popup-create-user.component.html diff --git a/admin/src/app/admin/userList/popup-create-user/popup-create-user.component.scss b/src/app/admin/userList/popup-create-user/popup-create-user.component.scss similarity index 100% rename from admin/src/app/admin/userList/popup-create-user/popup-create-user.component.scss rename to src/app/admin/userList/popup-create-user/popup-create-user.component.scss diff --git a/admin/src/app/admin/userList/popup-create-user/popup-create-user.component.spec.ts b/src/app/admin/userList/popup-create-user/popup-create-user.component.spec.ts similarity index 100% rename from admin/src/app/admin/userList/popup-create-user/popup-create-user.component.spec.ts rename to src/app/admin/userList/popup-create-user/popup-create-user.component.spec.ts diff --git a/admin/src/app/admin/userList/popup-create-user/popup-create-user.component.ts b/src/app/admin/userList/popup-create-user/popup-create-user.component.ts similarity index 100% rename from admin/src/app/admin/userList/popup-create-user/popup-create-user.component.ts rename to src/app/admin/userList/popup-create-user/popup-create-user.component.ts diff --git a/admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.html b/src/app/admin/userList/popup-delete-user/popup-delete-user.component.html similarity index 100% rename from admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.html rename to src/app/admin/userList/popup-delete-user/popup-delete-user.component.html diff --git a/admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.scss b/src/app/admin/userList/popup-delete-user/popup-delete-user.component.scss similarity index 100% rename from admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.scss rename to src/app/admin/userList/popup-delete-user/popup-delete-user.component.scss diff --git a/admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.spec.ts b/src/app/admin/userList/popup-delete-user/popup-delete-user.component.spec.ts similarity index 100% rename from admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.spec.ts rename to src/app/admin/userList/popup-delete-user/popup-delete-user.component.spec.ts diff --git a/admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.ts b/src/app/admin/userList/popup-delete-user/popup-delete-user.component.ts similarity index 100% rename from admin/src/app/admin/userList/popup-delete-user/popup-delete-user.component.ts rename to src/app/admin/userList/popup-delete-user/popup-delete-user.component.ts diff --git a/admin/src/app/admin/utils/navbar-admin/navbar-admin.component.html b/src/app/admin/utils/navbar-admin/navbar-admin.component.html similarity index 100% rename from admin/src/app/admin/utils/navbar-admin/navbar-admin.component.html rename to src/app/admin/utils/navbar-admin/navbar-admin.component.html diff --git a/admin/src/app/admin/utils/navbar-admin/navbar-admin.component.scss b/src/app/admin/utils/navbar-admin/navbar-admin.component.scss similarity index 100% rename from admin/src/app/admin/utils/navbar-admin/navbar-admin.component.scss rename to src/app/admin/utils/navbar-admin/navbar-admin.component.scss diff --git a/admin/src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts b/src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts similarity index 100% rename from admin/src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts rename to src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts diff --git a/admin/src/app/admin/utils/navbar-admin/navbar-admin.component.ts b/src/app/admin/utils/navbar-admin/navbar-admin.component.ts similarity index 100% rename from admin/src/app/admin/utils/navbar-admin/navbar-admin.component.ts rename to src/app/admin/utils/navbar-admin/navbar-admin.component.ts diff --git a/admin/src/app/app-routing.module.ts b/src/app/app-routing.module.ts similarity index 100% rename from admin/src/app/app-routing.module.ts rename to src/app/app-routing.module.ts diff --git a/admin/src/app/app.component.html b/src/app/app.component.html similarity index 100% rename from admin/src/app/app.component.html rename to src/app/app.component.html diff --git a/admin/src/app/app.component.scss b/src/app/app.component.scss similarity index 100% rename from admin/src/app/app.component.scss rename to src/app/app.component.scss diff --git a/admin/src/app/app.component.spec.ts b/src/app/app.component.spec.ts similarity index 100% rename from admin/src/app/app.component.spec.ts rename to src/app/app.component.spec.ts diff --git a/admin/src/app/app.component.ts b/src/app/app.component.ts similarity index 100% rename from admin/src/app/app.component.ts rename to src/app/app.component.ts diff --git a/admin/src/app/app.module.ts b/src/app/app.module.ts similarity index 100% rename from admin/src/app/app.module.ts rename to src/app/app.module.ts diff --git a/admin/src/app/beforeConnexion/login/page-login/page-login.component.html b/src/app/beforeConnexion/login/page-login/page-login.component.html similarity index 100% rename from admin/src/app/beforeConnexion/login/page-login/page-login.component.html rename to src/app/beforeConnexion/login/page-login/page-login.component.html diff --git a/admin/src/app/beforeConnexion/login/page-login/page-login.component.scss b/src/app/beforeConnexion/login/page-login/page-login.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/login/page-login/page-login.component.scss rename to src/app/beforeConnexion/login/page-login/page-login.component.scss diff --git a/admin/src/app/beforeConnexion/login/page-login/page-login.component.spec.ts b/src/app/beforeConnexion/login/page-login/page-login.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/login/page-login/page-login.component.spec.ts rename to src/app/beforeConnexion/login/page-login/page-login.component.spec.ts diff --git a/admin/src/app/beforeConnexion/login/page-login/page-login.component.ts b/src/app/beforeConnexion/login/page-login/page-login.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/login/page-login/page-login.component.ts rename to src/app/beforeConnexion/login/page-login/page-login.component.ts diff --git a/admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.html b/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.html similarity index 100% rename from admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.html rename to src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.html diff --git a/admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.scss b/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.scss rename to src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.scss diff --git a/admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.spec.ts b/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.spec.ts rename to src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.spec.ts diff --git a/admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.ts b/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.ts rename to src/app/beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component.ts diff --git a/admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.html b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.html similarity index 100% rename from admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.html rename to src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.html diff --git a/admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.scss b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.scss rename to src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.scss diff --git a/admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.spec.ts b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.spec.ts rename to src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.spec.ts diff --git a/admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts rename to src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts diff --git a/admin/src/app/beforeConnexion/register/page-register/page-register.component.html b/src/app/beforeConnexion/register/page-register/page-register.component.html similarity index 100% rename from admin/src/app/beforeConnexion/register/page-register/page-register.component.html rename to src/app/beforeConnexion/register/page-register/page-register.component.html diff --git a/admin/src/app/beforeConnexion/register/page-register/page-register.component.scss b/src/app/beforeConnexion/register/page-register/page-register.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/register/page-register/page-register.component.scss rename to src/app/beforeConnexion/register/page-register/page-register.component.scss diff --git a/admin/src/app/beforeConnexion/register/page-register/page-register.component.spec.ts b/src/app/beforeConnexion/register/page-register/page-register.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/page-register/page-register.component.spec.ts rename to src/app/beforeConnexion/register/page-register/page-register.component.spec.ts diff --git a/admin/src/app/beforeConnexion/register/page-register/page-register.component.ts b/src/app/beforeConnexion/register/page-register/page-register.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/page-register/page-register.component.ts rename to src/app/beforeConnexion/register/page-register/page-register.component.ts diff --git a/admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.html b/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.html similarity index 100% rename from admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.html rename to src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.html diff --git a/admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.scss b/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.scss rename to src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.scss diff --git a/admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.spec.ts b/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.spec.ts rename to src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.spec.ts diff --git a/admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.ts b/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.ts rename to src/app/beforeConnexion/register/popup-confirmation/popup-confirmation.component.ts diff --git a/admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html similarity index 100% rename from admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html diff --git a/admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss similarity index 100% rename from admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss diff --git a/admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts similarity index 100% rename from admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts diff --git a/admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts similarity index 100% rename from admin/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts diff --git a/admin/src/app/utils/message/message.service.spec.ts b/src/app/utils/message/message.service.spec.ts similarity index 100% rename from admin/src/app/utils/message/message.service.spec.ts rename to src/app/utils/message/message.service.spec.ts diff --git a/admin/src/app/utils/message/message.service.ts b/src/app/utils/message/message.service.ts similarity index 100% rename from admin/src/app/utils/message/message.service.ts rename to src/app/utils/message/message.service.ts diff --git a/admin/src/app/utils/profil/profil.service.spec.ts b/src/app/utils/profil/profil.service.spec.ts similarity index 100% rename from admin/src/app/utils/profil/profil.service.spec.ts rename to src/app/utils/profil/profil.service.spec.ts diff --git a/admin/src/app/utils/profil/profil.service.ts b/src/app/utils/profil/profil.service.ts similarity index 100% rename from admin/src/app/utils/profil/profil.service.ts rename to src/app/utils/profil/profil.service.ts diff --git a/admin/src/app/utils/theme/theme.service.spec.ts b/src/app/utils/theme/theme.service.spec.ts similarity index 100% rename from admin/src/app/utils/theme/theme.service.spec.ts rename to src/app/utils/theme/theme.service.spec.ts diff --git a/admin/src/app/utils/theme/theme.service.ts b/src/app/utils/theme/theme.service.ts similarity index 100% rename from admin/src/app/utils/theme/theme.service.ts rename to src/app/utils/theme/theme.service.ts diff --git a/admin/src/assets/.gitkeep b/src/assets/.gitkeep similarity index 100% rename from admin/src/assets/.gitkeep rename to src/assets/.gitkeep diff --git a/admin/src/assets/darkBackground.webp b/src/assets/darkBackground.webp similarity index 100% rename from admin/src/assets/darkBackground.webp rename to src/assets/darkBackground.webp diff --git a/admin/src/assets/lightBackground.jpg b/src/assets/lightBackground.jpg similarity index 100% rename from admin/src/assets/lightBackground.jpg rename to src/assets/lightBackground.jpg diff --git a/admin/src/assets/logo.png b/src/assets/logo.png similarity index 100% rename from admin/src/assets/logo.png rename to src/assets/logo.png diff --git a/admin/src/assets/logo_plateforms/dailymotion.png b/src/assets/logo_plateforms/dailymotion.png similarity index 100% rename from admin/src/assets/logo_plateforms/dailymotion.png rename to src/assets/logo_plateforms/dailymotion.png diff --git a/admin/src/assets/logo_plateforms/youtube.png b/src/assets/logo_plateforms/youtube.png similarity index 100% rename from admin/src/assets/logo_plateforms/youtube.png rename to src/assets/logo_plateforms/youtube.png diff --git a/admin/src/assets/play.png b/src/assets/play.png similarity index 100% rename from admin/src/assets/play.png rename to src/assets/play.png diff --git a/admin/src/assets/profil.png b/src/assets/profil.png similarity index 100% rename from admin/src/assets/profil.png rename to src/assets/profil.png diff --git a/admin/src/assets/uploadFile.png b/src/assets/uploadFile.png similarity index 100% rename from admin/src/assets/uploadFile.png rename to src/assets/uploadFile.png diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts new file mode 100644 index 0000000..eb1488d --- /dev/null +++ b/src/environments/environment.prod.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + debutUrl: "https://api-polynotfound.herokuapp.com/api/" +}; diff --git a/admin/src/environments/environment.ts b/src/environments/environment.ts similarity index 100% rename from admin/src/environments/environment.ts rename to src/environments/environment.ts diff --git a/admin/src/favicon.ico b/src/favicon.ico similarity index 100% rename from admin/src/favicon.ico rename to src/favicon.ico diff --git a/admin/src/index.html b/src/index.html similarity index 100% rename from admin/src/index.html rename to src/index.html diff --git a/admin/src/main.ts b/src/main.ts similarity index 100% rename from admin/src/main.ts rename to src/main.ts diff --git a/admin/src/polyfills.ts b/src/polyfills.ts similarity index 100% rename from admin/src/polyfills.ts rename to src/polyfills.ts diff --git a/admin/src/styles.scss b/src/styles.scss similarity index 100% rename from admin/src/styles.scss rename to src/styles.scss diff --git a/admin/src/test.ts b/src/test.ts similarity index 100% rename from admin/src/test.ts rename to src/test.ts diff --git a/admin/tsconfig.app.json b/tsconfig.app.json similarity index 100% rename from admin/tsconfig.app.json rename to tsconfig.app.json diff --git a/admin/tsconfig.json b/tsconfig.json similarity index 100% rename from admin/tsconfig.json rename to tsconfig.json diff --git a/admin/tsconfig.spec.json b/tsconfig.spec.json similarity index 100% rename from admin/tsconfig.spec.json rename to tsconfig.spec.json