mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 02:20:17 +01:00
ajout du support pour les réseaux sociaux
This commit is contained in:
39
code/server/reseaux_sociaux/structures.js
Normal file
39
code/server/reseaux_sociaux/structures.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Review } from "../borne/structures.js";
|
||||
|
||||
export class ReseauxReview extends Review{
|
||||
/**
|
||||
*
|
||||
* @param {ReseauxAuteur} auteur Auteur de l'avis
|
||||
* @param {String} source La source de l'avis
|
||||
* @param {String} date La date de l'avis au format YYYY-MM-DD
|
||||
* @param {Number} note Nombre entre 0 et 10, la note attribuée
|
||||
* @param {String} commentaire Le commentaire laissé par l'utilisateur
|
||||
* @param {String} lien Lien vers le commentaire
|
||||
*/
|
||||
constructor(auteur, source, date, note=null, commentaire=null, lien=null,) {
|
||||
super(auteur,note,source,commentaire);
|
||||
this.lien = lien;
|
||||
this.date = date;
|
||||
if(!lien instanceof String && lien != null) {
|
||||
throw new Error("Lien invalide");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ReseauxAuteur {
|
||||
/**
|
||||
*
|
||||
* @param {String} nom Nom de l'utilisateur
|
||||
* @param {String} source Réseau social de provenance de l'utilisateur
|
||||
* @param {String} lien Lien vers le profil de l'utilisateur
|
||||
*/
|
||||
constructor(nom, source, lien=null) {
|
||||
this.nom = nom;
|
||||
this.source = source;
|
||||
this.lien = lien;
|
||||
|
||||
if(!this.nom instanceof String || !this.source instanceof String || !this.lien instanceof String) {
|
||||
throw new Error("Auteur invalide");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user