image video à la place de iframe
|
|
@ -3,11 +3,11 @@ const {sendError, sendMessage} = require ("../config/response.config");
|
|||
const {checkLogin} = require("../config/sessionJWT.config");
|
||||
const Playlist = db.playlists;
|
||||
|
||||
// Create a new Playlist
|
||||
// Create a new PlaylistDB
|
||||
exports.create = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.create not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.create not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -15,31 +15,31 @@ exports.create = (req, res) => {
|
|||
exports.findAll = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.findAll not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.findAll not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Retrieve a single Playlist with id
|
||||
// Retrieve a single PlaylistDB with id
|
||||
exports.findOne = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.findOne not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.findOne not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Update a Playlist with id
|
||||
// Update a PlaylistDB with id
|
||||
exports.update = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.update not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.update not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Delete a Playlist with id
|
||||
// Delete a PlaylistDB with id
|
||||
exports.delete = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.delete not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.delete not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -47,6 +47,6 @@ exports.delete = (req, res) => {
|
|||
exports.deleteAll = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Playlist.deleteAll not Implemented", token);
|
||||
return sendError(res, 501, -1, "PlaylistDB.deleteAll not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ exports.logout = (req, res) => {
|
|||
exports.create = (req, res) => {
|
||||
// Validate request
|
||||
if (!req.body.login || !req.body.hashPass || !req.body.mail) {
|
||||
sendError(res, 400,-1,"Content can not be empty . (login, hashPass and mail needed");
|
||||
sendError(res, 400,-1,"Content can not be empty . (login, hashPass and email needed");
|
||||
}
|
||||
else{
|
||||
User.exists({login: req.body.login}, function (err, docs){
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ const {sendError, sendMessage} = require ("../config/response.config");
|
|||
const {checkLogin} = require("../config/sessionJWT.config");
|
||||
const Video = db.video;
|
||||
|
||||
// Search Video
|
||||
// Search VideoDB
|
||||
exports.search = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.search not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.search not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -15,15 +15,15 @@ exports.search = (req, res) => {
|
|||
exports.history = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.search not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.search not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Create a new Video
|
||||
// Create a new VideoDB
|
||||
exports.create = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.create not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.create not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -31,31 +31,31 @@ exports.create = (req, res) => {
|
|||
exports.findAll = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.findAll not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.findAll not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Retrieve a single Video with id
|
||||
// Retrieve a single VideoDB with id
|
||||
exports.findOne = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.findOne not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.findOne not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Update a Video with id
|
||||
// Update a VideoDB with id
|
||||
exports.update = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.update not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.update not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
// Delete a Video with id
|
||||
// Delete a VideoDB with id
|
||||
exports.delete = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.delete not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.delete not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -63,6 +63,6 @@ exports.delete = (req, res) => {
|
|||
exports.deleteAll = (req, res) => {
|
||||
const token = checkLogin(req, res);
|
||||
if(token){
|
||||
return sendError(res, 501, -1, "Video.deleteAll not Implemented", token);
|
||||
return sendError(res, 501, -1, "VideoDB.deleteAll not Implemented", token);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@ const playlists = require("../controllers/playlist.controller");
|
|||
module.exports = app => {
|
||||
let router = require("express").Router();
|
||||
|
||||
// Create a new Playlist
|
||||
// Create a new PlaylistDB
|
||||
router.post("/playlist/create", playlists.create);
|
||||
|
||||
// Retrieve all Playlists
|
||||
router.get("/playlist/findAll", playlists.findAll);
|
||||
|
||||
// Retrieve a single Playlist with id
|
||||
// Retrieve a single PlaylistDB with id
|
||||
router.get("/playlist/findOne/:id", playlists.findOne);
|
||||
|
||||
// Update a Playlist with id
|
||||
// Update a PlaylistDB with id
|
||||
router.put("/playlist/update/:id", playlists.update);
|
||||
|
||||
// Delete a Playlist with id
|
||||
// Delete a PlaylistDB with id
|
||||
router.delete("/playlist/delete/:id", playlists.delete);
|
||||
|
||||
// Delete all Playlists
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ const roles = require("./app-backend/config/role.config");
|
|||
const User = db.users;
|
||||
const login = 'superAdmin';
|
||||
const hashPass = 'hashPassSuperAdmin';
|
||||
const mail = 'superAdmin@mail.admin';
|
||||
const mail = 'superAdmin@email.admin';
|
||||
|
||||
User.exists({role: roles.SuperAdmin}, function (err, docs){
|
||||
if(err){
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {AfterViewInit, Component, ViewChild} from '@angular/core';
|
|||
import {MatSort} from "@angular/material/sort";
|
||||
import {MatPaginator} from "@angular/material/paginator";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
|
|
@ -10,6 +9,7 @@ import {Advert} from "../../../utils/interfaces/advert";
|
|||
import {PopupVisualizeAdAdminComponent} from "../popup-visualize-ad-admin/popup-visualize-ad-admin.component";
|
||||
import {PopupDeleteAdAdminComponent} from "../popup-delete-ad-admin/popup-delete-ad-admin.component";
|
||||
import {PopupVisualizeImagesAdminComponent} from "../popup-visualize-images-admin/popup-visualize-images-admin.component";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
ngAfterViewInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
const tabAdvert = this.fictitiousDatasService.getTabAdvert(8);
|
||||
const tabAdvert = this.fictitiousAdvertsService.getTabAdvert(8);
|
||||
this.dataSource = new MatTableDataSource<Advert>(tabAdvert);
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import {Advert} from "../../../utils/interfaces/advert";
|
|||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-delete-ad-admin',
|
||||
templateUrl: './popup-delete-ad-admin.component.html',
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="admin.profilePictureUrl"
|
||||
<img [src]="admin.profileImageUrl"
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'">
|
||||
</div>
|
||||
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
<div class="col-6 myValue"> {{admin.login}} </div>
|
||||
</div>
|
||||
|
||||
<!-- mail -->
|
||||
<!-- email -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Mail:</div>
|
||||
<div class="col-6 myValue"> {{admin.mail}} </div>
|
||||
<div class="col-6 myValue"> {{admin.email}} </div>
|
||||
</div>
|
||||
|
||||
<!-- createdAt -->
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {User} from "../../../utils/interfaces/user";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {PopupUpdateAdminComponent} from "../popup-update-admin/popup-update-admin.component";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -20,14 +20,14 @@ export class PageProfilAdminComponent implements OnInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousUsersService: FictitiousUsersService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.admin = this.fictitiousDatasService.getAdmin();
|
||||
this.admin = this.fictitiousUsersService.getAdmin();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
<!-- photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="adminCopy.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="adminCopy.profilePictureUrl" style="width: 90%">
|
||||
<img [src]="adminCopy.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="adminCopy.profileImageUrl" style="width: 90%">
|
||||
</div>
|
||||
|
||||
<!-- divider -->
|
||||
|
|
@ -16,12 +16,6 @@
|
|||
<input matInput type="text" [(ngModel)]="adminCopy.login">
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="adminCopy.mail">
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- divider -->
|
||||
<mat-divider></mat-divider><br>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import {Component, Inject, OnInit} from '@angular/core';
|
|||
import {User} from "../../../utils/interfaces/user";
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-update-admin',
|
||||
templateUrl: './popup-update-admin.component.html',
|
||||
|
|
@ -28,12 +30,12 @@ export class PopupUpdateAdminComponent implements OnInit
|
|||
_id: admin0._id,
|
||||
login: admin0.login,
|
||||
hashPass: admin0.hashPass,
|
||||
mail: admin0.mail,
|
||||
email: admin0.mail,
|
||||
role: {
|
||||
name: admin0.role.name,
|
||||
permission: admin0.role.permission,
|
||||
},
|
||||
profilePictureUrl: admin0.profilePictureUrl,
|
||||
profileImageUrl: admin0.profileImageUrl,
|
||||
dateOfBirth: admin0.dateOfBirth,
|
||||
gender: admin0.gender,
|
||||
interests: [],
|
||||
|
|
@ -68,11 +70,11 @@ export class PopupUpdateAdminComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'login'" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.adminCopy.mail.length === 0) {
|
||||
else if(this.adminCopy.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.adminCopy.mail)) {
|
||||
else if(!this.isValidEmail(this.adminCopy.email)) {
|
||||
this.errorMessage = "Email invalide" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} f
|
|||
import {COMMA, ENTER} from "@angular/cdk/keycodes";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {Observable} from "rxjs";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {map, startWith} from "rxjs/operators";
|
||||
import {MatChipInputEvent} from "@angular/material/chips";
|
||||
import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-input-interests-admin',
|
||||
|
|
@ -26,7 +28,7 @@ export class InputInterestsAdminComponent implements OnInit
|
|||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor( private fictitiousDatasService: FictitiousDatasService,
|
||||
constructor( private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
|
|
@ -37,7 +39,7 @@ export class InputInterestsAdminComponent implements OnInit
|
|||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
||||
|
||||
// --- FAUX CODE ---
|
||||
this.allInterests = this.fictitiousDatasService.getTags();
|
||||
this.allInterests = this.fictitiousUtilsService.getTags();
|
||||
this.allInterests.sort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@
|
|||
</ng-container>
|
||||
|
||||
<!-- Mail Column -->
|
||||
<ng-container matColumnDef="mail">
|
||||
<ng-container matColumnDef="email">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Mail </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
{{user.mail}}
|
||||
{{user.email}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {AfterViewInit, Component, ViewChild} from '@angular/core';
|
|||
import {MatSort} from "@angular/material/sort";
|
||||
import {MatPaginator} from "@angular/material/paginator";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
|
|
@ -10,6 +9,7 @@ import {User} from "../../../utils/interfaces/user";
|
|||
import {PopupVisualizeUserComponent} from "../popup-visualize-user/popup-visualize-user.component";
|
||||
import {PopupDeleteUserComponent} from "../popup-delete-user/popup-delete-user.component";
|
||||
import {PopupCreateUserComponent} from "../popup-create-user/popup-create-user.component";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -21,9 +21,9 @@ import {PopupCreateUserComponent} from "../popup-create-user/popup-create-user.c
|
|||
export class PageUserListComponent implements AfterViewInit
|
||||
{
|
||||
displayedColumns: string[];
|
||||
displayedColumnsUser: string[] = [ 'login', 'mail', 'dateOfBirth', 'age', 'sexe', 'interests', 'createdAt', 'lastConnexion', 'actions' ];
|
||||
displayedColumnsAdvertiser: string[] = [ 'login', 'mail', 'createdAt', 'lastConnexion', 'isAccepted', 'actions' ];
|
||||
displayedColumnsAdmin: string[] = [ 'login', 'mail', 'createdAt', 'lastConnexion', 'actions' ];
|
||||
displayedColumnsUser: string[] = [ 'login', 'email', 'dateOfBirth', 'age', 'sexe', 'interests', 'createdAt', 'lastConnexion', 'actions' ];
|
||||
displayedColumnsAdvertiser: string[] = [ 'login', 'email', 'createdAt', 'lastConnexion', 'isAccepted', 'actions' ];
|
||||
displayedColumnsAdmin: string[] = [ 'login', 'email', 'createdAt', 'lastConnexion', 'actions' ];
|
||||
|
||||
tabUser: any[] = [];
|
||||
tabAdvertiser: User[] = [];
|
||||
|
|
@ -36,7 +36,7 @@ export class PageUserListComponent implements AfterViewInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousUsersService: FictitiousUsersService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ export class PageUserListComponent implements AfterViewInit
|
|||
ngAfterViewInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
this.tabUser = this.fictitiousDatasService.getTabUser(32);
|
||||
this.tabAdvertiser = this.fictitiousDatasService.getTabAdvertiser(8);
|
||||
this.tabAdmin = this.fictitiousDatasService.getTabAdmin(4);
|
||||
this.tabUser = this.fictitiousUsersService.getTabUser(32);
|
||||
this.tabAdvertiser = this.fictitiousUsersService.getTabAdvertiser(8);
|
||||
this.tabAdmin = this.fictitiousUsersService.getTabAdmin(4);
|
||||
|
||||
for(const user of this.tabUser) user.age = this.getAge(user.dateOfBirth);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
|
||||
<!-- photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="user.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="user.profilePictureUrl" style="width: 90%">
|
||||
<img [src]="user.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="user.profileImageUrl" style="width: 90%">
|
||||
</div><br>
|
||||
|
||||
<div class="row">
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<!-- Email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="email" [(ngModel)]="user.mail" required>
|
||||
<input matInput type="email" [(ngModel)]="user.email" required>
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- Login -->
|
||||
|
|
@ -113,14 +113,14 @@
|
|||
|
||||
<!-- photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="user.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="user.profilePictureUrl" style="width: 90%">
|
||||
<img [src]="user.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="user.profileImageUrl" style="width: 90%">
|
||||
</div><br>
|
||||
|
||||
<!-- email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="user.mail">
|
||||
<input matInput type="text" [(ngModel)]="user.email">
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- login -->
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ export class PopupCreateUserComponent implements OnInit
|
|||
_id: "",
|
||||
login: "",
|
||||
hashPass: "",
|
||||
mail: "",
|
||||
email: "",
|
||||
role: {
|
||||
name: "",
|
||||
permission: 0,
|
||||
},
|
||||
profilePictureUrl: "",
|
||||
profileImageUrl: "",
|
||||
dateOfBirth: null,
|
||||
gender: "man",
|
||||
interests: [],
|
||||
|
|
@ -68,7 +68,7 @@ export class PopupCreateUserComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'login'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.user.mail.length === 0) {
|
||||
else if(this.user.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ export class PopupCreateUserComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.user.mail)) {
|
||||
else if(!this.isValidEmail(this.user.email)) {
|
||||
this.errorMessage = "Email invalide";
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="col-6 myValue"> {{user.login}} </div>
|
||||
</div>
|
||||
|
||||
<!-- mail -->
|
||||
<!-- email -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Mail:</div>
|
||||
<div class="col-6 myValue"> {{user.mail}} </div>
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import {Observable} from "rxjs";
|
|||
import {map, startWith} from "rxjs/operators";
|
||||
import {MatChipInputEvent} from "@angular/material/chips";
|
||||
import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ export class InputTagsComponent implements OnInit
|
|||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor( private fictitiousDatasService: FictitiousDatasService,
|
||||
constructor( private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ export class InputTagsComponent implements OnInit
|
|||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allTags.slice()));
|
||||
|
||||
// --- FAUX CODE ---
|
||||
this.allTags = this.fictitiousDatasService.getTags();
|
||||
this.allTags = this.fictitiousUtilsService.getTags();
|
||||
this.allTags.sort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
|
|
@ -11,6 +10,7 @@ import {PopupDeleteAdAdvertiserComponent} from "../popup-delete-ad-advertiser/po
|
|||
import {PopupVisualizeAdAdvertiserComponent} from "../popup-visualize-ad-advertiser/popup-visualize-ad-advertiser.component";
|
||||
import {MatPaginator} from "@angular/material/paginator";
|
||||
import {PopupVisualizeImagesAdvertiserComponent} from "../popup-visualize-images-advertiser/popup-visualize-images-advertiser.component";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
|||
ngAfterViewInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
const tabAdvert = this.fictitiousDatasService.getTabAdvert(8);
|
||||
const tabAdvert = this.fictitiousAdvertsService.getTabAdvert(8);
|
||||
this.dataSource = new MatTableDataSource<Advert>(tabAdvert);
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
|
|
|
|||
|
|
@ -7,15 +7,17 @@ import {ThemeService} from "../../../utils/services/theme/theme.service";
|
|||
|
||||
const ADVERT_VIDE: Advert = {
|
||||
_id: "",
|
||||
userId: "",
|
||||
title: "",
|
||||
advertiser: "",
|
||||
images: [],
|
||||
tags: [],
|
||||
comment: "",
|
||||
views: 0,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
isVisible: true,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="advertiser.profilePictureUrl"
|
||||
<img [src]="advertiser.profileImageUrl"
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'">
|
||||
</div>
|
||||
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
<div class="col-6 myValue"> {{advertiser.login}} </div>
|
||||
</div>
|
||||
|
||||
<!-- mail -->
|
||||
<!-- email -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Mail:</div>
|
||||
<div class="col-6 myValue"> {{advertiser.mail}} </div>
|
||||
<div class="col-6 myValue"> {{advertiser.email}} </div>
|
||||
</div>
|
||||
|
||||
<!-- createdAt -->
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {User} from "../../../utils/interfaces/user";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {PopupUpdateAdvertiserComponent} from "../popup-update-advertiser/popup-update-advertiser.component";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,14 +19,14 @@ export class PageProfilAdvertiserComponent implements OnInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousUsersService: FictitiousUsersService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.advertiser = this.fictitiousDatasService.getAdvertiser();
|
||||
this.advertiser = this.fictitiousUsersService.getAdvertiser();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
<!-- photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="advertiserCopy.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="advertiserCopy.profilePictureUrl" style="width: 90%">
|
||||
<img [src]="advertiserCopy.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image" type="text" [(ngModel)]="advertiserCopy.profileImageUrl" style="width: 90%">
|
||||
</div>
|
||||
|
||||
<!-- divider -->
|
||||
|
|
@ -16,12 +16,6 @@
|
|||
<input matInput type="text" [(ngModel)]="advertiserCopy.login">
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="advertiserCopy.mail">
|
||||
</mat-form-field><br>
|
||||
|
||||
<!-- divider -->
|
||||
<mat-divider></mat-divider><br>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ export class PopupUpdateAdvertiserComponent implements OnInit
|
|||
_id: advertiser0._id,
|
||||
login: advertiser0.login,
|
||||
hashPass: advertiser0.hashPass,
|
||||
mail: advertiser0.mail,
|
||||
email: advertiser0.mail,
|
||||
role: {
|
||||
name: advertiser0.role.name,
|
||||
permission: advertiser0.role.permission,
|
||||
},
|
||||
profilePictureUrl: advertiser0.profilePictureUrl,
|
||||
profileImageUrl: advertiser0.profileImageUrl,
|
||||
dateOfBirth: advertiser0.dateOfBirth,
|
||||
gender: advertiser0.gender,
|
||||
interests: [],
|
||||
|
|
@ -70,11 +70,11 @@ export class PopupUpdateAdvertiserComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'login'" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.advertiserCopy.mail.length === 0) {
|
||||
else if(this.advertiserCopy.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.advertiserCopy.mail)) {
|
||||
else if(!this.isValidEmail(this.advertiserCopy.email)) {
|
||||
this.errorMessage = "Email invalide" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const routes: Routes = [
|
|||
{ path: 'admin', component: PageUserListComponent },
|
||||
{ path: 'admin/userList', component: PageUserListComponent },
|
||||
{ path: 'admin/adList', component: PageAdListAdminComponent },
|
||||
{ path: 'admin/myProfil', component: PageProfilAdminComponent }
|
||||
{ path: 'admin/myProfil', component: PageProfilAdminComponent },
|
||||
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ import {HttpClientModule} from "@angular/common/http";
|
|||
import { PopupConfirmationComponent } from './beforeConnexion/register/popup-confirmation/popup-confirmation.component';
|
||||
import {MatDialogModule} from '@angular/material/dialog';
|
||||
import {MatButtonModule} from "@angular/material/button";
|
||||
import { AdvertComponent } from './utils/components/advert/advert.component';
|
||||
import { AdvertComponent } from './user/utils/components/advert/advert.component';
|
||||
import { VideoGridComponent } from './user/search/video-grid/video-grid.component';
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
import { PopupAddVideoToPlaylistsComponent } from './utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component';
|
||||
import { PopupAddVideoToPlaylistsComponent } from './user/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component';
|
||||
import {MatInputModule} from "@angular/material/input";
|
||||
import {MatDividerModule} from "@angular/material/divider";
|
||||
import {MatCheckboxModule} from "@angular/material/checkbox";
|
||||
|
|
@ -27,7 +27,7 @@ import {MatGridListModule} from "@angular/material/grid-list";
|
|||
import { PageMyPlaylistsComponent } from './user/myPlaylists/page-my-playlists/page-my-playlists.component';
|
||||
import { PlaylistListComponent } from './user/myPlaylists/playlist-list/playlist-list.component';
|
||||
import {VideoListComponent} from "./user/myPlaylists/video-list/video-list.component";
|
||||
import { PopupCreatePlaylistComponent } from './utils/components/popup-create-playlist/popup-create-playlist.component';
|
||||
import { PopupCreatePlaylistComponent } from './user/utils/components/popup-create-playlist/popup-create-playlist.component';
|
||||
import { PageHistoryUserComponent } from './user/history/page-history-user/page-history-user.component';
|
||||
import {MatTableModule} from '@angular/material/table';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
|
@ -45,7 +45,7 @@ import {IvyCarouselModule} from "angular-responsive-carousel";
|
|||
import { DragAndDropComponent } from './advertiser/adList/drag-and-drop/drag-and-drop.component';
|
||||
import { DragAndDropDirective } from './utils/directives/dragAndDrop/drag-and-drop.directive';
|
||||
import { PageProfilUserComponent } from './user/myProfil/page-profil-user/page-profil-user.component';
|
||||
import { NavbarUserComponent } from './user/navbar-user/navbar-user.component';
|
||||
import { NavbarUserComponent } from './user/utils/components/navbar-user/navbar-user.component';
|
||||
import { NavbarAdvertiserComponent } from './advertiser/navbar-advertiser/navbar-advertiser.component';
|
||||
import { NavbarAdminComponent } from './admin/navbar-admin/navbar-admin.component';
|
||||
import { PageProfilAdvertiserComponent } from './advertiser/myProfil/page-profil-advertiser/page-profil-advertiser.component';
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} f
|
|||
import {COMMA, ENTER} from "@angular/cdk/keycodes";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {Observable} from "rxjs";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {map, startWith} from "rxjs/operators";
|
||||
import {MatChipInputEvent} from "@angular/material/chips";
|
||||
import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-input-interests-register',
|
||||
|
|
@ -26,7 +26,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
|||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor( private fictitiousDatasService: FictitiousDatasService,
|
||||
constructor( private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
|||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
||||
|
||||
// --- FAUX CODE ---
|
||||
this.allInterests = this.fictitiousDatasService.getTags();
|
||||
this.allInterests = this.fictitiousUtilsService.getTags();
|
||||
this.allInterests.sort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<mat-step label="Type de compte">
|
||||
<form style="margin-top: 10px">
|
||||
<!-- Choix du rôle -->
|
||||
<mat-radio-group [(ngModel)]="user.role.name">
|
||||
<mat-radio-group [(ngModel)]="user.role.name" (click)="hasError = false; errorMessage = '';">
|
||||
<mat-radio-button value="user">Utilisateur standard</mat-radio-button>
|
||||
<mat-radio-button value="advertiser">Annonceur</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<!-- Email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="email" [(ngModel)]="user.mail" required>
|
||||
<input matInput type="email" [(ngModel)]="user.email" required>
|
||||
</mat-form-field>
|
||||
<br>
|
||||
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
<!-- Email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="email" [(ngModel)]="user.mail" required>
|
||||
<input matInput type="email" [(ngModel)]="user.email" required>
|
||||
</mat-form-field>
|
||||
<br>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ export class PageRegisterComponent
|
|||
_id: "",
|
||||
login: "",
|
||||
hashPass: "",
|
||||
mail: "",
|
||||
email: "",
|
||||
role: {
|
||||
name: "user",
|
||||
permission: 0,
|
||||
},
|
||||
profilePictureUrl: "",
|
||||
profileImageUrl: "",
|
||||
dateOfBirth: null,
|
||||
gender: "man",
|
||||
interests: [],
|
||||
|
|
@ -98,11 +98,11 @@ export class PageRegisterComponent
|
|||
this.errorMessage = "Veuillez remplir le champ 'login'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.user.mail.length === 0) {
|
||||
else if(this.user.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.user.mail)) {
|
||||
else if(!this.isValidEmail(this.user.email)) {
|
||||
this.errorMessage = "Email invalide.";
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@
|
|||
<ng-container matColumnDef="aperçu">
|
||||
<th mat-header-cell *matHeaderCellDef> Aperçu </th>
|
||||
<td mat-cell *matCellDef="let video">
|
||||
<img [src]="video.imageUrl" width="200px" height="100px">
|
||||
<!--
|
||||
<iframe appIframeTracker
|
||||
[src]=videoUrlService.safeUrl(video.url)
|
||||
[src]=videoUrlService.safeUrl(video.videoId)
|
||||
(iframeClick)="onIframeClick(video)"
|
||||
allowfullscreen></iframe>
|
||||
-->
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
@ -35,9 +38,7 @@
|
|||
<ng-container matColumnDef="date">
|
||||
<th mat-header-cell *matHeaderCellDef> Date </th>
|
||||
<td mat-cell *matCellDef="let video">
|
||||
<li *ngFor="let date0 of video.watched">
|
||||
{{date0 | date:'dd/LL/YYYY à HH:mm:ss'}}
|
||||
</li>
|
||||
{{video.watchedDates[video.watchedDates.length-1] | date:'dd/LL/YYYY à HH:mm:ss'}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,27 +9,11 @@ table {
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/*
|
||||
mat-paginator {
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
}
|
||||
*/
|
||||
|
||||
th.mat-sort-header-sorted {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/*
|
||||
.lightTheme td {
|
||||
padding: 10px 30px 5px 5px;
|
||||
}
|
||||
.darkTheme td {
|
||||
background-color: #646464;
|
||||
color: white;
|
||||
padding: 10px 30px 5px 5px;
|
||||
}
|
||||
*/
|
||||
|
||||
input {
|
||||
width: 35%;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import {AfterViewInit, Component, ViewChild} from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.service";
|
||||
import {UserHistoryService} from "../../../utils/services/userHistory/userHistory.service";
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
import {VideoUrlService} from "../../utils/services/videoUrl/video-url.service";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {MatPaginator} from "@angular/material/paginator";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
import {VideoAll} from "../../../utils/interfaces/video";
|
||||
|
||||
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
|
||||
constructor( public themeService: ThemeService,
|
||||
private messageService: MessageService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousVideosService: FictitiousVideosService,
|
||||
public videoUrlService: VideoUrlService,
|
||||
private userHistoryService: UserHistoryService ) { }
|
||||
|
||||
|
|
@ -37,23 +37,8 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
this.userHistoryService.clearTabVideoUrlClicked();
|
||||
|
||||
// --- FAUX CODE ---
|
||||
const tabVideo: Video[] = this.fictitiousDatasService.getTabVideo(8);
|
||||
|
||||
const tabVideoChanged = [];
|
||||
for(let video of tabVideo)
|
||||
{
|
||||
tabVideoChanged.push({
|
||||
_id: video._id,
|
||||
url: video.url,
|
||||
title: video.title,
|
||||
description: video.description,
|
||||
views: video.views,
|
||||
watched: video.watched,
|
||||
source: this.getSourceByUrl(video.url)
|
||||
});
|
||||
}
|
||||
|
||||
this.dataSource = new MatTableDataSource(tabVideoChanged);
|
||||
const tabVideo: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8);
|
||||
this.dataSource = new MatTableDataSource(tabVideo);
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource = this.dataSource;
|
||||
|
|
@ -92,7 +77,7 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
|
||||
|
||||
// Supprime la video
|
||||
onDelete(video: Video): void
|
||||
onDelete(video: VideoAll): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
const index = this.dataSource.data.indexOf(video);
|
||||
|
|
@ -118,11 +103,11 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
|
||||
// Ajoute la date actuelle dans watched.video
|
||||
onIframeClick(video: Video): void
|
||||
// Ajoute la date actuelle dans watchedDates.video
|
||||
onIframeClick(video: VideoAll): void
|
||||
{
|
||||
console.log("onIframeClick: " + video.title);
|
||||
this.userHistoryService.addVideoToHistoque(video);
|
||||
//this.userHistoryService.addVideoToHistoque(video);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<!-- liste des playlist -->
|
||||
<mat-grid-tile colspan="4" rowspan="1" class="celluleListePlaylist">
|
||||
<app-playlist-list [allPlaylists]="allPlaylists" (eventEmitter)="transmitToVideoList($event)"></app-playlist-list>
|
||||
<app-playlist-list (eventEmitter)="transmitToVideoList($event)"></app-playlist-list>
|
||||
</mat-grid-tile>
|
||||
|
||||
<!-- pub -->
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {Playlist} from "../../../utils/interfaces/playlist";
|
||||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
@ -13,21 +14,19 @@ import {Playlist} from "../../../utils/interfaces/playlist";
|
|||
})
|
||||
export class PageMyPlaylistsComponent implements OnInit
|
||||
{
|
||||
allPlaylists: Playlist[]; // toutes les playlists
|
||||
ad: Advert; // pub
|
||||
playlist: Playlist; // la playlist sélectionnée
|
||||
playlist: PlaylistDB; // la playlist sélectionnée
|
||||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private messageService: MessageService,
|
||||
private fictitioousData: FictitiousDatasService ) { }
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
this.allPlaylists = this.fictitioousData.getTabPlaylist(10, 10);
|
||||
this.ad = this.fictitioousData.getAdvert();
|
||||
this.ad = this.fictitiousAdvertsService.getAdvert();
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
|
|
@ -44,7 +43,7 @@ export class PageMyPlaylistsComponent implements OnInit
|
|||
*/
|
||||
}
|
||||
|
||||
transmitToVideoList(playlist: Playlist): void
|
||||
transmitToVideoList(playlist: PlaylistDB): void
|
||||
{
|
||||
this.playlist = playlist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
<div *ngFor="let playlist of tabPlaylist" class="playlistContainer">
|
||||
<button class="btnPlaylist" (click)="eventEmitter.emit(playlist)">
|
||||
<span class="playlistName"> {{playlist.name}} </span><br>
|
||||
<span class="playListCount"> {{playlist.videos.length}} vidéos </span>
|
||||
<span class="playListCount" *ngIf="playlist.videoIds.length <= 1"> {{playlist.videoIds.length}} vidéo </span>
|
||||
<span class="playListCount" *ngIf="playlist.videoIds.length > 1"> {{playlist.videoIds.length}} vidéos </span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {Playlist} from "../../../utils/interfaces/playlist";
|
||||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {PopupCreatePlaylistComponent} from "../../../utils/components/popup-create-playlist/popup-create-playlist.component";
|
||||
import {PopupCreatePlaylistComponent} from "../../utils/components/popup-create-playlist/popup-create-playlist.component";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -15,19 +16,21 @@ import {PopupCreatePlaylistComponent} from "../../../utils/components/popup-crea
|
|||
})
|
||||
export class PlaylistListComponent implements OnInit
|
||||
{
|
||||
@Input() allPlaylists: Playlist[] = []; // toutes les playlists
|
||||
@Output() eventEmitter = new EventEmitter<Playlist>(); // pour envoyer au parent la playlist selectionner
|
||||
allPlaylists: PlaylistDB[] = []; // toutes les playlists
|
||||
@Output() eventEmitter = new EventEmitter<PlaylistDB>(); // pour envoyer au parent la playlist selectionner
|
||||
search: string = "" ; // contenu de la barre de recherche
|
||||
tabPlaylist: Playlist[] = []; // playlist affichées
|
||||
tabPlaylist: PlaylistDB[] = []; // playlist affichées
|
||||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
public dialog: MatDialog,
|
||||
public snackBar: MatSnackBar ) { }
|
||||
public snackBar: MatSnackBar,
|
||||
private fictitiousVideosService: FictitiousVideosService ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.allPlaylists = this.fictitiousVideosService.getTabPlaylistDB(10, 10);
|
||||
this.tabPlaylist = [].concat(this.allPlaylists);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<!-- Bordure haute -->
|
||||
<div class="row topBorder">
|
||||
|
||||
<!-- Playlist existe ? -->
|
||||
<!-- PlaylistDB existe ? -->
|
||||
<div *ngIf="(playlist !== null) && (playlist !== undefined); then ok1 else nope1"></div>
|
||||
|
||||
<!-- oui -->
|
||||
|
|
@ -27,31 +27,52 @@
|
|||
<div class="row" style="margin: 0px; padding: 0px">
|
||||
<div class="listVideoContainer">
|
||||
|
||||
<!-- Playlist existe ? -->
|
||||
<!-- 'playlist' existe ? -->
|
||||
<div *ngIf="(playlist !== null) && (playlist !== undefined); then ok2 else nope2"></div>
|
||||
|
||||
<!-- oui -->
|
||||
<!-- oui, 'playlist' existe -->
|
||||
<ng-template #ok2>
|
||||
<div *ngFor="let video of playlist.videos ; let i = index" class="videoContainer">
|
||||
<!-- bouton add -->
|
||||
<button mat-icon-button (click)="onAdd(video)">
|
||||
<mat-icon> add_circle </mat-icon>
|
||||
</button>
|
||||
<!-- video -->
|
||||
<iframe appIframeTracker
|
||||
[src]=videoUrlService.safeUrl(this.video.url)
|
||||
allowfullscreen
|
||||
(iframeClick)="onIframeClick(this.video)"></iframe>
|
||||
<!-- bouton delete -->
|
||||
<button mat-icon-button (click)="onDelete(video, i)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button><br/>
|
||||
<div *ngFor="let video of videosInPlaylist; let i = index;" class="videoContainer">
|
||||
|
||||
<mat-grid-list cols="12" rowHeight="15vh">
|
||||
|
||||
<!-- btnAdd -->
|
||||
<mat-grid-tile [colspan]="1" [rowspan]="1">
|
||||
<button mat-icon-button (click)="onAdd(video)">
|
||||
<mat-icon> add_circle </mat-icon>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
|
||||
<!-- imgVideo -->
|
||||
<mat-grid-tile [colspan]="10" [rowspan]="1">
|
||||
<div class="col-8">
|
||||
<div style="margin: auto; width: 20vw; height: 15vh;">
|
||||
<div class="imgsContainer">
|
||||
<img class="imgPlay" src="/assets/play7.png">
|
||||
<img class="imgVideo" [src]="video.imageUrl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-grid-tile>
|
||||
|
||||
<!-- btnDelete -->
|
||||
<mat-grid-tile [colspan]="1" [rowspan]="1">
|
||||
<button mat-icon-button (click)="onDelete(video, i)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
|
||||
</mat-grid-list>
|
||||
|
||||
<!-- titre video -->
|
||||
<span>{{video.title}}</span>
|
||||
<span style="margin-top: 10px">
|
||||
{{video.title}}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<!-- non -->
|
||||
<!-- non, 'playlist' n'existe pas -->
|
||||
<ng-template #nope2>
|
||||
<div></div>
|
||||
</ng-template>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,30 @@
|
|||
|
||||
.videoContainer {
|
||||
border-bottom: solid 1px black;
|
||||
padding: 25px;
|
||||
padding: 15px 0px 15px 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.imgsContainer {
|
||||
position: relative;
|
||||
width: 20vw;
|
||||
height: 15vh;
|
||||
}
|
||||
|
||||
.imgPlay {
|
||||
position: absolute;
|
||||
margin-left: 9vw;
|
||||
width: 3vw;
|
||||
margin-top: 5vh;
|
||||
height: 6vh;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.imgVideo {
|
||||
border: solid 1px black;
|
||||
width: 20vw;
|
||||
height: 15vh;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
// BottomBorder --------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.service";
|
||||
import {AddVideoToPlaylistsService} from "../../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {VideoAll, VideoDB} from "../../../utils/interfaces/video";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {Playlist} from "../../../utils/interfaces/playlist";
|
||||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {UserHistoryService} from "../../../utils/services/userHistory/userHistory.service";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -16,31 +16,49 @@ import {UserHistoryService} from "../../../utils/services/userHistory/userHistor
|
|||
templateUrl: './video-list.component.html',
|
||||
styleUrls: ['./video-list.component.scss']
|
||||
})
|
||||
export class VideoListComponent
|
||||
export class VideoListComponent implements OnChanges
|
||||
{
|
||||
@Input() playlist: Playlist;
|
||||
@Input() playlist: PlaylistDB;
|
||||
videosInPlaylist: VideoAll[] = [];
|
||||
allUserVideos: VideoAll[] = this.fictitiousVideosService.getAllVideoAll();
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
public videoUrlService: VideoUrlService,
|
||||
private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private addVideoToPlaylistService: AddVideoToPlaylistsService,
|
||||
private snackBar: MatSnackBar,
|
||||
private historiqueService: UserHistoryService ) { }
|
||||
public fictitiousVideosService: FictitiousVideosService,
|
||||
private historiqueService: UserHistoryService ) { }
|
||||
|
||||
|
||||
onAdd(video: Video): void
|
||||
ngOnChanges(changes: SimpleChanges): void
|
||||
{
|
||||
if((this.playlist !== null) && (this.playlist !== undefined))
|
||||
{
|
||||
this.videosInPlaylist = [];
|
||||
for(let _idVideo of this.playlist.videoIds)
|
||||
{
|
||||
const video = this.allUserVideos.find(video => video._id === _idVideo);
|
||||
this.videosInPlaylist.push(video);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onAdd(video: VideoAll): void
|
||||
{
|
||||
this.addVideoToPlaylistService.run(video);
|
||||
}
|
||||
|
||||
|
||||
onDelete(video0: Video, indexVideo: number): void
|
||||
onDelete(video0: VideoAll, indexVideo: number): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
let message = "La video a bien été supprimé de la playlist" ;
|
||||
this.playlist.videos.splice(indexVideo, 1);
|
||||
this.playlist.videoIds.splice(indexVideo, 1);
|
||||
this.videosInPlaylist.splice(indexVideo, 1);
|
||||
|
||||
let message = "La video a bien été supprimé de la playlist";
|
||||
const config = { duration: 1000, panelClass: "custom-class" };
|
||||
this.snackBar.open( message, "", config);
|
||||
|
||||
|
|
@ -60,13 +78,9 @@ export class VideoListComponent
|
|||
this.snackBar.open( message, "", config);
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
onIframeClick(video: Video): void
|
||||
{
|
||||
console.log("onIframeClick: " + video.title);
|
||||
this.historiqueService.addVideoToHistoque(video);
|
||||
//Pour relier les collections "Videos" et "Playlists", on a mis l'attribut "playlistIds" dans "Videos"
|
||||
// Mais en vrai, ça serai plus facile pour moi si on mettait plutot un attribut "videoIds" dans "Playlists"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} f
|
|||
import {COMMA, ENTER} from "@angular/cdk/keycodes";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {Observable} from "rxjs";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {map, startWith} from "rxjs/operators";
|
||||
import {MatChipInputEvent} from "@angular/material/chips";
|
||||
import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
@ -27,7 +28,7 @@ export class InputInterestsProfilComponent implements OnInit
|
|||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor( private fictitiousDatasService: FictitiousDatasService,
|
||||
constructor( private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ export class InputInterestsProfilComponent implements OnInit
|
|||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
||||
|
||||
// --- FAUX CODE ---
|
||||
this.allInterests = this.fictitiousDatasService.getTags();
|
||||
this.allInterests = this.fictitiousUtilsService.getTags();
|
||||
this.allInterests.sort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="user.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'">
|
||||
<img [src]="user.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'">
|
||||
</div>
|
||||
|
||||
<!-- Col gauche & droite -->
|
||||
|
|
@ -41,10 +41,10 @@
|
|||
<div class="col-4 myValue"> {{user.login}} </div>
|
||||
</div>
|
||||
|
||||
<!-- mail -->
|
||||
<!-- email -->
|
||||
<div class="row myRow">
|
||||
<div class="col-8 myLabel">Mail:</div>
|
||||
<div class="col-4 myValue"> {{user.mail}} </div>
|
||||
<div class="col-4 myValue"> {{user.email}} </div>
|
||||
</div>
|
||||
|
||||
<!-- gender -->
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {User} from "../../../utils/interfaces/user";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {PopupUpdateUserComponent} from "../popup-update-user/popup-update-user.component";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,14 +19,14 @@ export class PageProfilUserComponent implements OnInit
|
|||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousUsersService: FictitiousUsersService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.user = this.fictitiousDatasService.getUser();
|
||||
this.user = this.fictitiousUsersService.getUser();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center; font-size: small">
|
||||
<img [src]="userCopy.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<img [src]="userCopy.profileImageUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||
<input title="lien vers image"
|
||||
type="text"
|
||||
class="form-control inputUrlImage"
|
||||
style="font-size: small"
|
||||
[(ngModel)]="userCopy.profilePictureUrl">
|
||||
[(ngModel)]="userCopy.profileImageUrl">
|
||||
</div><br>
|
||||
|
||||
<!-- Col gauche & droite -->
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ export class PopupUpdateUserComponent implements OnInit
|
|||
_id: user0._id,
|
||||
login: user0.login,
|
||||
hashPass: user0.hashPass,
|
||||
mail: user0.mail,
|
||||
email: user0.mail,
|
||||
role: {
|
||||
name: user0.role.name,
|
||||
permission: user0.role.permission,
|
||||
},
|
||||
profilePictureUrl: user0.profilePictureUrl,
|
||||
profileImageUrl: user0.profileImageUrl,
|
||||
dateOfBirth: user0.dateOfBirth,
|
||||
gender: user0.gender,
|
||||
interests: [],
|
||||
|
|
@ -70,11 +70,11 @@ export class PopupUpdateUserComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'login'." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.userCopy.mail.length === 0) {
|
||||
else if(this.userCopy.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.userCopy.mail)) {
|
||||
else if(!this.isValidEmail(this.userCopy.email)) {
|
||||
this.errorMessage = "Email invalide." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
import {VideoAll} from "../../../utils/interfaces/video";
|
||||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
|
||||
|
||||
|
||||
let TAB_PLATEFORM = [
|
||||
{ name: "Youtube", isSelected: false },
|
||||
{ name: "Dailymotion", isSelected: false }
|
||||
{ name: "youtube", isSelected: false },
|
||||
{ name: "dailymotion", isSelected: false }
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -22,23 +23,24 @@ let TAB_PLATEFORM = [
|
|||
export class PageSearchComponent implements OnInit
|
||||
{
|
||||
tabPlateform = TAB_PLATEFORM;
|
||||
tabVideo: Video[] = [];
|
||||
tabVideo: VideoAll[] = [];
|
||||
search: string = "";
|
||||
ad1: Advert;
|
||||
ad2: Advert;
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousVideosService: FictitiousVideosService,
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService,
|
||||
public themeService: ThemeService ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
this.tabVideo = this.fictitiousDatasService.getTabVideo(11);
|
||||
this.ad1 = this.fictitiousDatasService.getAdvert();
|
||||
this.ad2 = this.fictitiousDatasService.getAdvert();
|
||||
this.tabVideo = this.fictitiousVideosService.getTabVideoAll(90);
|
||||
this.ad1 = this.fictitiousAdvertsService.getAdvert();
|
||||
this.ad2 = this.fictitiousAdvertsService.getAdvert();
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
|
|
@ -62,7 +64,7 @@ export class PageSearchComponent implements OnInit
|
|||
onSearch()
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
this.tabVideo = this.fictitiousDatasService.getTabVideo(2);
|
||||
this.tabVideo = this.fictitiousVideosService.getTabVideoAll(2);
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -7,15 +7,43 @@
|
|||
<mat-grid-tile colspan="1" rowspan="1" *ngFor="let k of [0,1,2,3,4,5,6,7,8]">
|
||||
<div class="myCell" *ngIf="indexPage+k < tabVideo.length" [title]="tabVideo[indexPage+k].title">
|
||||
|
||||
<iframe appIframeTracker
|
||||
[src]=videoUrlService.safeUrl(tabVideo[indexPage+k].url)
|
||||
allowfullscreen
|
||||
(iframeClick)="onIframeClick(tabVideo[indexPage+k])"></iframe><br>
|
||||
|
||||
<span> {{tronquage(tabVideo[indexPage+k].title)}} </span>
|
||||
<button mat-icon-button (click)="onAdd(tabVideo[indexPage+k])">
|
||||
<mat-icon> add_circle </mat-icon>
|
||||
</button>
|
||||
<!-- Image video -->
|
||||
<div class="imgsContainer">
|
||||
<img class="imgPlay" src="/assets/play7.png">
|
||||
<img class="imgVideo" [src]="tabVideo[indexPage+k].imageUrl">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Info video -->
|
||||
<mat-grid-list cols="12" style="margin: 0px 0px 0px 0px; font-size: small">
|
||||
|
||||
<!-- logo -->
|
||||
<mat-grid-tile [colspan]="2" [rowspan]="2" class="mat-grid-tile-info-video">
|
||||
<img *ngIf="tabVideo[indexPage+k].source==='youtube'" src="/assets/logo_plateforms/youtube.png" alt="ytb" width="20px" height="15px">
|
||||
<img *ngIf="tabVideo[indexPage+k].source==='dailymotion'" src="/assets/logo_plateforms/dailymotion.png" alt="dlm" width="20px" height="20px">
|
||||
</mat-grid-tile>
|
||||
|
||||
<!-- title + views + publishedAt -->
|
||||
<mat-grid-tile [colspan]="8" [rowspan]="2" class="mat-grid-tile-info-video">
|
||||
<div style="position: absolute; left: 1px; text-align: left">
|
||||
{{tronquage(tabVideo[indexPage+k].title)}}
|
||||
<br>
|
||||
<span style="color: gray">
|
||||
{{tabVideo[indexPage+k].views | number: '1.0-0'}} vues. Il y a 2h.
|
||||
</span>
|
||||
</div>
|
||||
</mat-grid-tile>
|
||||
|
||||
<!-- addButton -->
|
||||
<mat-grid-tile [colspan]="2" [rowspan]="2" class="mat-grid-tile-info-video">
|
||||
<button mat-icon-button (click)="onAdd(tabVideo[indexPage+k])">
|
||||
<mat-icon>add_circle</mat-icon>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
|
||||
</mat-grid-list>
|
||||
|
||||
|
||||
</div>
|
||||
</mat-grid-tile>
|
||||
|
|
@ -23,8 +51,25 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Paginator -->
|
||||
<div class="btnContainer">
|
||||
|
||||
<!-- btn précédent -->
|
||||
<button mat-button class="btnPaginator" [disabled]="indexPage<=0" (click)="indexPage=indexPage-9"> < Précédent </button>
|
||||
|
||||
<!-- numeros de page -->
|
||||
<span *ngFor="let page of [1,2,3,4,5,6,7,8,9,10]" (click)="indexPage=(page-1)*9">
|
||||
<span *ngIf="page===((indexPage/9)+1)">
|
||||
<span style="text-decoration: underline; cursor: pointer;font-weight: bold;">{{page}}</span>
|
||||
</span>
|
||||
<span *ngIf="page!==((indexPage/9)+1)">
|
||||
<span style="text-decoration: underline; cursor: pointer;">{{page}}</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<!-- btn suivant -->
|
||||
<button mat-button class="btnPaginator" [disabled]="indexPage+9>=tabVideo.length" (click)="indexPage=indexPage+9"> Suivant > </button>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
mat-grid-list {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
mat-grid-tile {
|
||||
|
|
@ -9,19 +10,47 @@ mat-grid-tile {
|
|||
border: solid 1px black;
|
||||
}
|
||||
|
||||
.myCell {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 7px 0px 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.myCell {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 15px 0px 0px 0px;
|
||||
.imgsContainer {
|
||||
width: 20vw;
|
||||
height: 15vh;
|
||||
}
|
||||
|
||||
iframe {
|
||||
.imgPlay {
|
||||
position: absolute;
|
||||
margin-left: 9vw;
|
||||
width: 3vw;
|
||||
margin-top: 5vh;
|
||||
height: 6vh;
|
||||
padding: 0px 0px 0px 0px;
|
||||
width: 85%;
|
||||
}
|
||||
|
||||
.imgVideo {
|
||||
border: solid 1px black;
|
||||
width: 20vw;
|
||||
height: 15vh;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.mat-grid-tile-info-video {
|
||||
border: none;
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import {Component, Input, OnChanges } from '@angular/core';
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
import {UserHistoryService} from "../../../utils/services/userHistory/userHistory.service";
|
||||
import {AddVideoToPlaylistsService} from "../../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.service";
|
||||
import {VideoAll} from "../../../utils/interfaces/video";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {VideoUrlService} from "../../utils/services/videoUrl/video-url.service";
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
@ -12,7 +12,7 @@ import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.servic
|
|||
})
|
||||
export class VideoGridComponent implements OnChanges
|
||||
{
|
||||
@Input() tabVideo: Video[] = [];
|
||||
@Input() tabVideo: VideoAll[] = [];
|
||||
indexPage: number = 0;
|
||||
|
||||
constructor( private historiqueService: UserHistoryService,
|
||||
|
|
@ -25,21 +25,15 @@ export class VideoGridComponent implements OnChanges
|
|||
//this.historiqueService.clearTabVideoUrlClicked();
|
||||
}
|
||||
|
||||
onAdd(video: Video): void
|
||||
onAdd(video: VideoAll): void
|
||||
{
|
||||
this.addVideoToPlaylistsService.run(video);
|
||||
}
|
||||
|
||||
onIframeClick(video: Video)
|
||||
{
|
||||
console.log("onIframeClick: " + video.title);
|
||||
this.historiqueService.addVideoToHistoque(video);
|
||||
}
|
||||
|
||||
tronquage(str: string)
|
||||
{
|
||||
if(str.length < 30) return str;
|
||||
else return str.substring(0, 30) + "..." ;
|
||||
if(str.length < 40) return str;
|
||||
else return str.substring(0, 37) + "..." ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Advert} from "../../interfaces/advert";
|
||||
import {ThemeService} from "../../services/theme/theme.service";
|
||||
import {Advert} from "../../../../utils/interfaces/advert";
|
||||
import {ThemeService} from "../../../../utils/services/theme/theme.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {MessageService} from "../../services/message/message.service";
|
||||
import {VideoDB} from "../../../../utils/interfaces/video";
|
||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ import {MessageService} from "../../services/message/message.service";
|
|||
})
|
||||
export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||
{
|
||||
video: Video;
|
||||
video: VideoDB;
|
||||
tabPlaylistAndBool = [];
|
||||
goToCreatePlaylist = false;
|
||||
newPlaylistName = "";
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {MessageService} from "../../services/message/message.service";
|
||||
import {Playlist} from "../../interfaces/playlist";
|
||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
||||
import {PlaylistDB} from "../../../../utils/interfaces/playlist";
|
||||
|
||||
|
||||
|
||||
|
|
@ -36,11 +36,14 @@ export class PopupCreatePlaylistComponent implements OnInit
|
|||
this.checkError();
|
||||
if(!this.hasError)
|
||||
{
|
||||
const playlist: Playlist = {
|
||||
_id: "monId",
|
||||
user: null,
|
||||
const playlist: PlaylistDB = {
|
||||
_id: "",
|
||||
userId: "userId",
|
||||
name: this.name,
|
||||
videos: [],
|
||||
videoIds: [],
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
this.dialogRef.close(playlist);
|
||||
}
|
||||
|
|
@ -1,32 +1,34 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {MessageService} from "../message/message.service";
|
||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {PopupAddVideoToPlaylistsComponent} from "../../components/popup-add-video-to-playlists/popup-add-video-to-playlists.component";
|
||||
import {FictitiousDatasService} from "../fictitiousDatas/fictitious-datas.service";
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {VideoDB} from "../../../../utils/interfaces/video";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {FictitiousVideosService} from "../../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AddVideoToPlaylistsService
|
||||
{
|
||||
private _video: Video;
|
||||
private _video: VideoDB;
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public dialog: MatDialog,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
private fictitiousVideosService: FictitiousVideosService,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
// --- FAUX CODE ---
|
||||
run(video0: Video): void
|
||||
run(video0: VideoDB): void
|
||||
{
|
||||
this._video = video0;
|
||||
const retour = {
|
||||
status: "success",
|
||||
data: this.fictitiousDatasService.getTabPlaylist(4, 5),
|
||||
data: this.fictitiousVideosService.getTabPlaylistDB(4, 5),
|
||||
}
|
||||
this.afterReceivingPlaylists(retour)
|
||||
}
|
||||
|
|
@ -34,7 +36,7 @@ export class AddVideoToPlaylistsService
|
|||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
run(video0: Video): void
|
||||
run(video0: VideoDB): void
|
||||
{
|
||||
this._video = video0;
|
||||
this.messageService
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {MessageService} from "../message/message.service";
|
||||
import {VideoDB} from "../../../../utils/interfaces/video";
|
||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
@ -13,12 +15,12 @@ export class UserHistoryService
|
|||
constructor(private messageService: MessageService) { }
|
||||
|
||||
|
||||
public addVideoToHistoque(video: Video): void
|
||||
public addVideoToHistoque(video: VideoDB): void
|
||||
{
|
||||
if (!this.tabVideoUrlClicked.includes(video.url))
|
||||
if (!this.tabVideoUrlClicked.includes(video.videoId))
|
||||
{
|
||||
this.tabVideoUrlClicked.push(video.url);
|
||||
video.watched.push(new Date());
|
||||
this.tabVideoUrlClicked.push(video.videoId);
|
||||
video.watchedDates.push(new Date());
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
export interface Advert
|
||||
{
|
||||
_id: string,
|
||||
userId: string,
|
||||
title: string,
|
||||
advertiser: string,
|
||||
images: {
|
||||
|
|
@ -10,7 +11,8 @@ export interface Advert
|
|||
tags: string[],
|
||||
comment: string,
|
||||
views: number,
|
||||
isVisible: boolean,
|
||||
isActive: boolean,
|
||||
createdAt: Date,
|
||||
updatedAt: Date,
|
||||
isVisible: boolean,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import {Video} from "./video";
|
||||
|
||||
export interface Playlist
|
||||
export interface PlaylistDB
|
||||
{
|
||||
_id: string,
|
||||
user: any,
|
||||
userId: string,
|
||||
name: string,
|
||||
videos: Video[]
|
||||
videoIds: string[],
|
||||
isActive: boolean
|
||||
createdAt: Date,
|
||||
updatedAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
export interface User
|
||||
{
|
||||
_id: string,
|
||||
login: string,
|
||||
email: string,
|
||||
hashPass: string,
|
||||
mail: string,
|
||||
login: string,
|
||||
role: {
|
||||
name: string,
|
||||
permission: number,
|
||||
},
|
||||
profilePictureUrl: string,
|
||||
profileImageUrl: string,
|
||||
dateOfBirth: Date,
|
||||
gender: string,
|
||||
interests: string[],
|
||||
isActive: boolean,
|
||||
isAccepted: boolean,
|
||||
createdAt: Date,
|
||||
updatedAt: Date,
|
||||
lastConnexion: Date,
|
||||
createdAt: Date,
|
||||
updatedAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,30 @@
|
|||
export interface Video
|
||||
export interface VideoDB
|
||||
{
|
||||
_id: string,
|
||||
url: string,
|
||||
title: string,
|
||||
description: string,
|
||||
views: number,
|
||||
watched: Date[]
|
||||
userId: string,
|
||||
videoId: string,
|
||||
source: string,
|
||||
tags: String[],
|
||||
watchedDates: Date[],
|
||||
createdAt: Date,
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
|
||||
export interface VideoAll
|
||||
{
|
||||
_id: string,
|
||||
userId: string,
|
||||
videoId: string,
|
||||
source: string,
|
||||
tags: String[],
|
||||
watchedDates: Date[],
|
||||
createdAt: Date,
|
||||
updatedAt: Date
|
||||
|
||||
title: string,
|
||||
views: number,
|
||||
publishedAt: Date,
|
||||
description: string,
|
||||
imageUrl: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,340 +0,0 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {Playlist} from "../../interfaces/playlist";
|
||||
import {Advert} from "../../interfaces/advert";
|
||||
import {User} from "../../interfaces/user";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const TAB_VIDEO: Video[] = [
|
||||
{
|
||||
_id: "Mowgli",
|
||||
url: "https://www.youtube.com/watch?v=medPORJ8KO0",
|
||||
title: "PNL - Mowgli",
|
||||
description: "dans l'album Que la famille",
|
||||
views: 11,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Mexico",
|
||||
url: "https://www.youtube.com/watch?v=LZx6oeNeoWM",
|
||||
title: "PNL - Mexico",
|
||||
description: "dans l'album Monde chico",
|
||||
views: 22,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Luz de luna",
|
||||
url: "https://www.youtube.com/watch?v=fGoPhSV2Jic",
|
||||
title: "PNL - Luz de luna",
|
||||
description: "dans l'album Dans la legende",
|
||||
views: 33,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Blanka",
|
||||
url: "https://www.youtube.com/watch?v=u8bHjdljyLw",
|
||||
title: "PNL - Blanka",
|
||||
description: "dans l'album Deux frères",
|
||||
views: 44,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Mowgli 2",
|
||||
url: "https://www.dailymotion.com/video/x7ahxdn",
|
||||
title: "PNL - Mowgli",
|
||||
description: "exclu",
|
||||
views: 55,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Etre humain",
|
||||
url: "https://www.youtube.com/watch?v=gfVo39B92Ow",
|
||||
title: "Nekfeu - Etre humain",
|
||||
description: "dans l'album feu",
|
||||
views: 66,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Humanoide",
|
||||
url: "https://www.youtube.com/watch?v=MiyIg__WNOw",
|
||||
title: "Nekfeu - Humanoide",
|
||||
description: "dans l'album Cyborg",
|
||||
views: 77,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
url: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
description: "dans l'album Les etoiles vagabondes",
|
||||
views: 88,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
url: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
description: "dans l'album Les etoiles vagabondes",
|
||||
views: 99,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Les prélis",
|
||||
url: "https://www.dailymotion.com/video/x4trtkd",
|
||||
title: "Columbine - Les prélis",
|
||||
description: "dans l'album Enfant terrible",
|
||||
views: 100,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Pierre feuille ciseau",
|
||||
url: "https://www.dailymotion.com/video/x6agl6i",
|
||||
title: "Columbine - Pierre feuille ciseau",
|
||||
description: "exclu",
|
||||
views: 111,
|
||||
watched: []
|
||||
},
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const TAB_ADVERT: Advert[] = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const USER: User = {
|
||||
_id: "ririId",
|
||||
login: "Riri",
|
||||
hashPass: "agourgroou",
|
||||
mail: "riri@gmail.com",
|
||||
role: {
|
||||
name: "user",
|
||||
permission: 0,
|
||||
},
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: new Date(),
|
||||
gender: "man",
|
||||
interests: ["foot", "jeux-vidéo"],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
const ADVERTISER: User = {
|
||||
_id: "fifiId",
|
||||
login: "Fifi",
|
||||
hashPass: "agourgroou",
|
||||
mail: "fifi@gmail.com",
|
||||
role: {
|
||||
name: "advertiser",
|
||||
permission: 5,
|
||||
},
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
const ADMIN: User = {
|
||||
_id: "loulouId",
|
||||
login: "Loulou",
|
||||
hashPass: "agourgroou",
|
||||
mail: "loulou@gmail.com",
|
||||
role: {
|
||||
name: "admin",
|
||||
permission: 5,
|
||||
},
|
||||
profilePictureUrl: "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg?format=product-cover-large&k=1519639530",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousDatasService
|
||||
{
|
||||
|
||||
private makeid(length)
|
||||
{
|
||||
let res = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for( let i = 0; i < length; i++ ) {
|
||||
const k = Math.floor(Math.random() * characters.length);
|
||||
res += characters.charAt(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private randomDate(start, end): Date
|
||||
{
|
||||
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getVideo(): Video
|
||||
{
|
||||
const index = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
let video: Video = Object.assign({}, TAB_VIDEO[index]);
|
||||
|
||||
// id
|
||||
video._id = video._id + this.makeid(5);
|
||||
|
||||
// watched
|
||||
const nbWatched = 1 + Math.floor(Math.random() * 2);
|
||||
const start = new Date(2021, 0, 1);
|
||||
const end = new Date();
|
||||
video.watched = [];
|
||||
for(let i=0 ; i<nbWatched ; i++) video.watched.push(this.randomDate(start, end));
|
||||
|
||||
return video;
|
||||
}
|
||||
|
||||
getTabVideo(n: number): Video[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
for(let i=0 ; i<n ; i++) tabVideo.push(this.getVideo());
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getTabPlaylist(nbPlaylist: number, nbVideoMax: number)
|
||||
{
|
||||
let tabTabPlaylist: Playlist[] = [];
|
||||
|
||||
for (let i = 0; i < nbPlaylist; i++)
|
||||
{
|
||||
let playlist: Playlist = {
|
||||
_id: i.toString(),
|
||||
user: null,
|
||||
name: "playlist_"+i.toString(),
|
||||
videos: this.getTabVideo(Math.floor(Math.random() * nbVideoMax))
|
||||
}
|
||||
tabTabPlaylist.push(playlist);
|
||||
}
|
||||
|
||||
return tabTabPlaylist
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
private getUserOrAdvertiserOrAdmin(modele: User): User
|
||||
{
|
||||
const res = Object.assign({}, modele);
|
||||
res._id += this.makeid(5);
|
||||
res.login += (Math.floor(Math.random() * 1000)).toString();
|
||||
res.mail = res.login + "@gmail.com" ;
|
||||
res.isAccepted = (Math.random() < 0.5);
|
||||
return res;
|
||||
}
|
||||
|
||||
getUser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(USER);
|
||||
}
|
||||
|
||||
getAdvertiser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADVERTISER);
|
||||
}
|
||||
|
||||
getAdmin(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADMIN);
|
||||
}
|
||||
|
||||
getTabUser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getUser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdvertiser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdvertiser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdmin(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdmin());
|
||||
return res;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getTags(): string[]
|
||||
{
|
||||
return [ "musique", "rap", "rock", "sport", "foot", "basket", "tennis", "film", "action", "aventure", "horreur", "romance", "comedie"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousAdvertsService } from './fictitious-adverts.service';
|
||||
|
||||
describe('FictitiousAdvertsService', () => {
|
||||
let service: FictitiousAdvertsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousAdvertsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Advert} from "../../../interfaces/advert";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const TAB_ADVERT: Advert[] = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
userId: "userId",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
userId: "userId",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousAdvertsService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) {}
|
||||
|
||||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.fictitiousUtilsService.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousDatasService } from './fictitious-datas.service';
|
||||
import { FictitiousUsersService } from './fictitious-users.service';
|
||||
|
||||
describe('FictitiousDatasService', () => {
|
||||
let service: FictitiousDatasService;
|
||||
describe('FictitiousUsersService', () => {
|
||||
let service: FictitiousUsersService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousDatasService);
|
||||
service = TestBed.inject(FictitiousUsersService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {User} from "../../../interfaces/user";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const USER: User = {
|
||||
_id: "ririId",
|
||||
login: "Riri",
|
||||
hashPass: "agourgroou",
|
||||
email: "riri@gmail.com",
|
||||
role: {
|
||||
name: "user",
|
||||
permission: 0,
|
||||
},
|
||||
profileImageUrl: "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: new Date(),
|
||||
gender: "man",
|
||||
interests: ["foot", "jeux-vidéo"],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
};
|
||||
|
||||
const ADVERTISER: User = {
|
||||
_id: "fifiId",
|
||||
login: "Fifi",
|
||||
hashPass: "agourgroou",
|
||||
email: "fifi@gmail.com",
|
||||
role: {
|
||||
name: "advertiser",
|
||||
permission: 5,
|
||||
},
|
||||
profileImageUrl: "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
|
||||
const ADMIN: User = {
|
||||
_id: "loulouId",
|
||||
login: "Loulou",
|
||||
hashPass: "agourgroou",
|
||||
email: "loulou@gmail.com",
|
||||
role: {
|
||||
name: "admin",
|
||||
permission: 5,
|
||||
},
|
||||
profileImageUrl: "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg?format=product-cover-large&k=1519639530",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousUsersService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) { }
|
||||
|
||||
private getUserOrAdvertiserOrAdmin(modele: User): User
|
||||
{
|
||||
const res = Object.assign({}, modele);
|
||||
res._id += this.fictitiousUtilsService.makeid(5);
|
||||
res.login += (Math.floor(Math.random() * 1000)).toString();
|
||||
res.email = res.login + "@gmail.com" ;
|
||||
res.isAccepted = (Math.random() < 0.5);
|
||||
return res;
|
||||
}
|
||||
|
||||
getUser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(USER);
|
||||
}
|
||||
|
||||
getAdvertiser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADVERTISER);
|
||||
}
|
||||
|
||||
getAdmin(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADMIN);
|
||||
}
|
||||
|
||||
getTabUser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getUser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdvertiser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdvertiser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdmin(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdmin());
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousUtilsService } from './fictitious-utils.service';
|
||||
|
||||
describe('FictitiousUtilsService', () => {
|
||||
let service: FictitiousUtilsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousUtilsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousUtilsService
|
||||
{
|
||||
|
||||
makeid(length)
|
||||
{
|
||||
let res = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for( let i = 0; i < length; i++ ) {
|
||||
const k = Math.floor(Math.random() * characters.length);
|
||||
res += characters.charAt(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
randomDate(start, end): Date
|
||||
{
|
||||
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
||||
}
|
||||
|
||||
|
||||
getTags(): string[]
|
||||
{
|
||||
return [ "musique", "rap", "rock", "sport", "foot", "basket", "tennis", "film", "action", "aventure", "horreur", "romance", "comedie"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousVideosService } from './fictitious-videos.service';
|
||||
|
||||
describe('FictitiousVideosService', () => {
|
||||
let service: FictitiousVideosService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousVideosService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {VideoAll} from "../../../interfaces/video";
|
||||
import {PlaylistDB} from "../../../interfaces/playlist";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const TAB_VIDEO: VideoAll[] = [
|
||||
{
|
||||
_id: "Mowgli",
|
||||
videoId: "https://www.youtube.com/watch?v=medPORJ8KO0",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mowgli",
|
||||
views: 999999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/CaeH7TRnI3s/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCr4TMUqy_Lqi9_zh7efICrF_V_Vw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Mexico",
|
||||
videoId: "https://www.youtube.com/watch?v=LZx6oeNeoWM",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mexico",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/LZx6oeNeoWM/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAIJsokYSLBB3TrnKhX5V1beCTrpQ",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Luz de luna",
|
||||
videoId: "https://www.youtube.com/watch?v=fGoPhSV2Jic",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Luz de luna",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/fGoPhSV2Jic/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBICz3ZfnjAXQNZQniiCTRLbdyLcg",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Blanka",
|
||||
videoId: "https://www.youtube.com/watch?v=u8bHjdljyLw",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Blanka",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/PCwZnN4zDiY/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCaA-xe5rkkYJbNCbSg0z27Lm1Hgw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Mowgli 2",
|
||||
videoId: "https://www.dailymotion.com/video/x7ahxdn",
|
||||
userId: "userId",
|
||||
source: "dailymotion",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mowgli 2",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/tno1qRfO894/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCOBBR6c3woXXIbOSdU06quQcN7pw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Etre humain",
|
||||
videoId: "https://www.youtube.com/watch?v=gfVo39B92Ow",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Etre humain",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/gfVo39B92Ow/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCPJpBqTYk5Nj3RSgase3GdbT7_Pg",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Humanoide",
|
||||
videoId: "https://www.youtube.com/watch?v=MiyIg__WNOw",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Nekfeu - Humanoide",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/MiyIg__WNOw/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDboAq0TRqXBFGgXdpOD_HOsRZucw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
videoId: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/-S5IKBvT34c/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLC1kVCIB2bQGmOH74I5puXIhn7HRQ",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Les prélis",
|
||||
videoId: "https://www.dailymotion.com/video/x4trtkd",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Columbine - Les prélis",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/an_webp/LfFI3bzMLU0/mqdefault_6s.webp?du=3000&sqp=CKq33owG&rs=AOn4CLDZmaPGWwcuo9yUWJ-xOzA69r2Qrw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Pierre feuille ciseau",
|
||||
videoId: "https://www.dailymotion.com/video/x6agl6i",
|
||||
userId: "userId",
|
||||
source: "dailymotion",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Columbine - Pierre feuille ciseau",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/tTo7CrPlbpI/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAhC5bWURH9R8Icdkv6LWRgsW2G-Q",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousVideosService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) {}
|
||||
|
||||
|
||||
getVideoAll(): VideoAll
|
||||
{
|
||||
const index = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
return TAB_VIDEO[index];
|
||||
//return Object.assign({}, TAB_VIDEO[index]);
|
||||
}
|
||||
|
||||
|
||||
getTabVideoAll(nbVideo: number): VideoAll[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
for(let i=0 ; i<nbVideo ; i++) tabVideo.push(this.getVideoAll());
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
|
||||
getTabPlaylistDB(nbPlaylist: number, nbVideoMax: number): PlaylistDB[]
|
||||
{
|
||||
let tabPlaylist: PlaylistDB[] = [];
|
||||
|
||||
for (let i = 0; i < nbPlaylist; i++)
|
||||
{
|
||||
const r = Math.floor(Math.random() * nbVideoMax);
|
||||
const tabVideo = this.getTabVideoAll(r);
|
||||
tabPlaylist.push({
|
||||
_id: "id_playlist_"+i.toString(),
|
||||
userId: "userId",
|
||||
name: "playlist_"+i.toString(),
|
||||
videoIds: tabVideo.map(x => x._id),
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
return tabPlaylist;
|
||||
}
|
||||
|
||||
|
||||
getAllVideoAll(): VideoAll[]
|
||||
{
|
||||
return TAB_VIDEO;
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
BIN
src/assets/play1.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/play2.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
src/assets/play3.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
src/assets/play4.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
src/assets/play5.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
src/assets/play6.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
src/assets/play7.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |