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

portfolio addition in user profile #47

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

dark-dev2475
Copy link
Contributor

Issue : #14

Have not made a separate schema for portfolio but added that in user profile schema...

Created API endpoints for managing user profiles, which include portfolio functionality:
POST /api/users/profile/:id/portfolio: Adds a portfolio item (title, URL, description) to a user's profile.
GET /api/users/profile/:id/portfolio: Retrieves all portfolio items for a user.
PUT /api/users/profile/:id/portfolio/:portfolioId: Updates an existing portfolio item for a user.
Ensured proper authorization by checking if the user is authenticated and if they are modifying their own profile. Unauthorized users receive a 403 status code.

User Authentication Middleware:

Implemented a middleware (authenticateUser) to authenticate users by verifying JWT tokens passed in the Authorization header.
The middleware ensures that only authenticated users can access certain routes, providing proper error handling for missing or invalid tokens.

Testing :

Added tests using Supertest to test the portfolio API functionalities, ensuring the creation, retrieval, and update of portfolio items work as expected.
Included tests for authentication and authorization, confirming that unauthorized users cannot modify another user's portfolio.
image

@Opencodeiiita-Bot
Copy link

Hey @dark-dev2475

Thanks for opening this PR 🚀. Mentor will review your pull request soon and till then, keep contributing and stay calm.

Thanks for contributing in OpenCode'24 ✨✨!

@PrinkalDhingra
Copy link
Collaborator

@dark-dev2475 kindly resolve the conflicts.

@dark-dev2475
Copy link
Contributor Author

done

@PrinkalDhingra PrinkalDhingra merged commit 8796bd8 into opencodeiiita:main Dec 18, 2024
@Opencodeiiita-Bot
Copy link

Hey @dark-dev2475

Your PR has been merged 🥳🥳 and you have earned 50 points.

Thanks for contributing in OpenCode'24 ✨✨

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.

3 participants