Skip to content
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

Added lecture to specific playlist #68

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

Anushkabh
Copy link
Contributor

Have you read the Contributing Guidelines?
yes

Issue #41

Describe your changes

Created a controller for adding lectures to playlist.
It first validates the existence of the specified course by its ID.
If the course exists, it checks if the lecture with the provided title already exists in the course. If so, it returns an error.
If the lecture is unique, it adds the lecture details (title, description, video public ID, and URL) to the course's lectures array.

Clearly and concisely describe what's in this pull request. Include screenshots, if necessary.

Copy link

vercel bot commented Jan 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
edumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2024 3:00pm

Copy link
Owner

@anand-harsh anand-harsh left a comment

Choose a reason for hiding this comment

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

take just title and description from req.body and id from req.params

@anand-harsh
Copy link
Owner

anand-harsh commented Jan 18, 2024

Have you read the Contributing Guidelines? yes

Issue #41

Describe your changes

Created a controller for adding lectures to playlist. It first validates the existence of the specified course by its ID. If the course exists, it checks if the lecture with the provided title already exists in the course. If so, it returns an error. If the lecture is unique, it adds the lecture details (title, description, video public ID, and URL) to the course's lectures array.

Clearly and concisely describe what's in this pull request. Include screenshots, if necessary.

Hi, I am sorry I had a confusion in route which I mentioned in issue

Take the route as /course/:id

Also add isAuthenticated and adminAuthorise middlewares, so that only admin has power to add lectures in course

@anand-harsh anand-harsh added JWOC JWOC open source program hard 8 points labels Jan 18, 2024
@Anushkabh
Copy link
Contributor Author

@anand-harsh i have made the changes .. kindly have a look at it

@anand-harsh
Copy link
Owner

Hi @Anushkabh , have you tested this api on your local?

@anand-harsh
Copy link
Owner

Hi @Anushkabh , have you tested this api for this endpoint on your local?

@Anushkabh
Copy link
Contributor Author

yes , but without using admin middleware

@anand-harsh
Copy link
Owner

yes , but without using admin middleware

send me screenshot of the request and response

Copy link
Owner

@anand-harsh anand-harsh left a comment

Choose a reason for hiding this comment

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

Go to models > Courses.js, comment out the required:true in lectures > video >public_id and url

controllers/courseController.js Outdated Show resolved Hide resolved
routes/courseRoutes.js Outdated Show resolved Hide resolved
@anand-harsh
Copy link
Owner

Hi @Anushkabh , your code works fine for all cases and admin auth too, just make the suggested changes and will be ready to merge

Copy link
Owner

@anand-harsh anand-harsh left a comment

Choose a reason for hiding this comment

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

LGTM💥💥

@anand-harsh anand-harsh merged commit 58d83b1 into anand-harsh:master Jan 18, 2024
2 checks passed
@Anushkabh
Copy link
Contributor Author

Screenshot (102)
Screenshot (103)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hard 8 points JWOC JWOC open source program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants