{"size": 1343, "ext": "js", "max_stars_repo_path": "dist/scripts/data/database.js", "max_stars_repo_name": "EmiliyanPanagyurski/Book-Reviews", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/scripts/data/database.js", "max_issues_repo_name": "EmiliyanPanagyurski/Book-Reviews", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/scripts/data/database.js", "max_forks_repo_name": "EmiliyanPanagyurski/Book-Reviews", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 1343.0, "max_line_length": 1343, "alphanum_fraction": 0.7557706627}
import{firebaseModule}from"firebase-config";class DataBase{constructor(e){this.database=e.database,this.auth=e.auth}createUser(e){return this.auth.createUserWithEmailAndPassword(e.email,e.password)}signInWithEmail(e){return this.auth.signInWithEmailAndPassword(e.email,e.password)}signOut(){return this.auth.signOut()}getCurrentUser(){return this.auth.currentUser}onAuthStateChanged(e){return this.auth.onAuthStateChanged(function(t){e(t)})}updateUserProfile(e){return this.getCurrentUser().updateProfile(e)}resetPassword(e){return this.auth.sendPasswordResetEmail(e)}createReview(e){this.database.ref("reviews/"+e.authorUid+e.title).set(e).catch(e=>{console.log(e.message)})}getAllReviews(){return new Promise((e,t)=>{this.database.ref("reviews/").once("value",t=>{e(t.val())})})}getReviews(e){return new Promise((t,a)=>{this.database.ref("reviews/").orderByChild(e.prop).equalTo(e.value.toUpperCase()).once("value",e=>{t(e.val())})})}getReview(e){return new Promise((t,a)=>{this.database.ref("reviews/").child(e).once("value",e=>{t(e.val())})})}createComment(e){this.database.ref("comments/").push(e).catch(e=>{console.log(e.message)})}getComments(e){return new Promise((t,a)=>{this.database.ref("comments/").orderByChild(e.prop).equalTo(e.value).once("value",e=>{t(e.val())})})}}const dataBase=new DataBase(firebaseModule);export{dataBase};