-
Notifications
You must be signed in to change notification settings - Fork 846
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
All TODO's complete #131
base: main
Are you sure you want to change the base?
All TODO's complete #131
Conversation
can you please tell me why is userId required in getAllVideos in video controller and how can it be accessed and sent in req.query. |
frontend code will be like this -> import axios from 'axios'; const getAllVideos = async (id) => { ---------OR------------ export const getAllVideos = (query= "", page= 1, sortBy= 'createdAt', sortType=1, userId= id) => async (dispatch) => {
}; |
i think the feature of a user getting all of his own uploaded videos should be in another feature since there is no need of any query in that but sir has commented to use userQuery...so shouldn't a separate controller be made for that since any $match or $search would not be needed due to absence of any user query also pls tell from if the id in btw..thnx a lot for replying..i dont have any person to solve my doubts in person..its just self learning..i appreciate your response |
I have checked the code. I think you are right. User_id should be optional for getting video. Because the user who doesn't log in is also able to get videos according to query. but if the user is logged in then the user-id could pass from frontend to check what types of videos the user prefers. so that if any algorithm will be applied in the future to check what kinds of videos users prefer then they can serve videos according to their preference (like on youtube, facebook etc.). I have applied user required at that time because of this line in video.routes.js file --> router.use(verifyJWT); // Apply verifyJWT middleware to all routes in this file
yes Now I have updated the code. Thanks for your suggestion. |
but if we apply verifyjwt to alll routes, any user who isnt logged in wont be able to search any videos since verifyjwt would reject access to that user as there wont be any tokens in cookies for a not-logged-in user... |
may be sir think so. But I have also updated the video routes in my code |
Hi sir, I have completed all the todos and learned many things.
I have also tested all todos with Postman.
Thanks for giving me such a great learning opportunity.