Skip to content

Conversation

@Yuliya110692
Copy link

No description provided.

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally looking really good! I've left a few comments of things to think about / improve :)


const SingleVideo = ({ video, handleDeleteVideoClick }) => {
const { title, url, rating, id } = video;
const [votes, setVotes] = useState(0); // can be 0, 1 or -1 => to add to rating when thumbsUp or ThumbsDown is clicked
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really good to include a comment explaining what values are allowed/possible when ony some values are allowed - good job!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, I don't see any code that prevents votes from being set to 2, or -2 - do you intend for there to be code stopping that?

className="responsive-iframe"
width="560"
height="310"
src={`https://www.youtube.com/embed/${url.split("v=")[1]}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if a URL didn't contain v=? Is there a way you could handle that better?

};

const handleAddVideo = async (title, url) => {
if (title !== "" && url !== "" && matchYoutubeUrl(url)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but often times we'll write this like:

if (title === "" || url === "" || !matchYoutubeUrl(url)) {
  setShowError(true);
  return;
}
try {
  ...
}

Can you talk through why that may be more clear?

@@ -0,0 +1,15 @@
const { Pool } = require('pg');

link = "postgres://vtsohdxm:jNSKq4-96QSdfZax4qdrprDhVwu-rcrF@surus.db.elephantsql.com/vtsohdxm"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't want to check this in, containing a password - can you use the dotenv library and a .env file to set this up instead?

});


app.delete("/:id", (req, res) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this to work on the database?


const result = schema.validate(req.body);
console.log(result)
const foundVideo = videos.find((booking) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

booking seems like a strange name for this parameter :)

}
});

app.put("/:id", (req, res) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this to work on the database?

@Dedekind561 Dedekind561 closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants