This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Developer= require('./Developer'); | |
| const Tester= require('./Tester'); | |
| const botFactory=(name, role, relaxTime){ | |
| if(role==='developer'){ | |
| return new Developer(name, relaxTime); | |
| } | |
| else{ | |
| return new Tester(name, relaxTime); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let Kayaker=require('./Kayaker') | |
| let Akshar= Kayaker.clone(); | |
| Akshar.name="Akshar"; | |
| Akshar.addStroke("forward stroke"); | |
| let Maddie= Kayaker.clone(); | |
| Maddie.name="Maddie"; | |
| Maddie.addStroke("back stroke"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Kayaker{ | |
| constructor(name='Give me a name'){ | |
| this.name=name; | |
| this.strokes=[]; | |
| } | |
| setName(name){ | |
| this.name=name; | |
| } | |
| getName(){ | |
| return this.name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Logger{ | |
| constructor(){ | |
| this.logs = []; | |
| } | |
| getTotalMessages() { | |
| return this.logs.length; | |
| } | |
| log(message){ | |
| this.logs.push(message); | |
| console.log(message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="container"> | |
| <div class="jumbotron text-center"> | |
| <h1>Your Have Been Invited!!</h1> | |
| <p> | |
| <%=result.sendername%> has invited you to join this wonderful app | |
| </p> | |
| <p> <%=result.sendername%> says: <%=result.sendermsg%></p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get("/invite/:id", (req, res) => { | |
| console.log(req.params); | |
| let sender = req.params.id | |
| .trim() | |
| .split("-")[0] | |
| .trim(); | |
| let inviteLink = req.params.id | |
| .trim() | |
| .split("-")[1] | |
| .trim(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| / user invitations | |
| app.get("/myInvitations", (req, res) => { | |
| let link=req.query.link | |
| console.log(link) | |
| client.query( | |
| `SELECT * from invitations where senderId='${link}'`, | |
| (err, doc) => { | |
| if (err) { | |
| console.log(err); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // function to get all the invitations | |
| function myInvitations() { | |
| if(document.getElementById('myInvites').children.length===0){ | |
| let link = document.getElementById('link').innerHTML; | |
| fetch(`/myInvitations?link=${link}`).then(res => res.json()).then(invites => { | |
| invites.forEach(invite => { | |
| addToList(invite.receiverid, invite.created_at, invite.updated_at) | |
| }); | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //send email function | |
| function sendEmail(_to, _from, _link) { | |
| console.log(process.env.password) | |
| var transporter = nodemailer.createTransport({ | |
| service: "gmail", | |
| auth: { | |
| user: process.env.email, | |
| pass: process.env.password | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //send email function | |
| function sendEmail(_to, _from, _link) { | |
| console.log(process.env.password) | |
| var transporter = nodemailer.createTransport({ | |
| service: "gmail", | |
| auth: { | |
| user: process.env.email, | |
| pass: process.env.password | |
| } | |
| }); |