-
-
Notifications
You must be signed in to change notification settings - Fork 357
London_10 | Yulia - Hospodar | Full-Stack-Project | #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
illicitonion
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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]}`} |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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" | |||
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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?
No description provided.