-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
need comment model
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.
looks good Pramith! just a couple of minor changes that i'd like, let me know if you have any questions about them!
backend/models/User.js
Outdated
addLikedPost = async (postId) => { | ||
this.props.likedPostList.push(postId); | ||
let post = await getPostById(postId); | ||
post.incrementScore(); // await? |
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.
await shouldn't be necessary UNLESS you want to wait for the "this.push()" to finish being executed in the incrementScore method. I don't think it'll be necessary though since it'll be faster if we let the two updates to Firebase happen at the same time (feel free to delete the comment as well)
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.
Unrelated to implementation but what do you think about having each post collect the users that like a post (I believe we could do this implementation wise by adding a user_list to post) but do you think we should do that or is it better to make likes anonymous (maybe we can ask the team about this too)
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.
I think collecting the users that like a post would be a good idea. It's easy to implement and offers us more options in the future so I think it's a good idea
@@ -17,7 +17,7 @@ class Course { | |||
} | |||
|
|||
getInstructorList() { | |||
return this.props.instructorList; | |||
return this.props.instructorList.slice(1, this.props.instructorList.length); |
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 was the purpose of this change?
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.
Rohith said that he and Pawan were going to initialize each list with a dummy string element to make sure Javascript knew that the list was a list of Strings. They wanted the list getters implemented this way to ignore that first dummy string
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.
Oh interesting okay I must not have caught that in a previous PR. Honestly that shouldn't be necessary but that could also be a refactor for later. Let's make a comment or something about that in the code to prevent future confusion.
@@ -35,6 +35,34 @@ class User { | |||
await this.push(); | |||
} | |||
|
|||
addLikedPost = async (postId) => { |
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.
In a future PR let's write tests for these to make sure that they work
const courseObj = await course.getCourseById(courseUUID); | ||
|
||
if (courseObj.getInstructorList().indexOf(userObj.getUUID()) != -1) { | ||
res.status(200).send("Instructor"); // send something else?? |
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.
(nitpick) Delete the comments
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.
Solid work! I am having issues running the routes though so let's sync up sometime today before merging and see why that's happening (I assume it worked on your end?)
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.
lgtm! just do last quick change on what the route sends and then feel free to merge
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.
lgtm
added user likes stuff and user/courseID routes