mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
Creation container pour l'API reviews
This commit is contained in:
39
code/reviews_api/reseaux_sociaux/structures.js
Normal file
39
code/reviews_api/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((typeof lien !== "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((typeof this.nom !== "string") || (typeof this.source !== "string")){
|
||||
throw new Error("Auteur invalide");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user