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

week-3 > 03-mongo > Readme.md | missing purchased property in Schema #587

Open
piyush-ramnani opened this issue Dec 28, 2023 · 0 comments
Open

Comments

@piyush-ramnani
Copy link

ISSUE:
In the POST route while registering the user, it is not specified that the user should have a third property as purchased of type array. As the user purchases the course, it should have a purchased property set while signing up where all the purchases would be saved.

User Routes

GET: /users/purchasedCourses
Description: Lists all the courses purchased by the user. Input: Headers: { 'username': 'username', 'password': 'password' } Output: { purchasedCourses: [ { id: 1, title: 'course title', description: 'course description', price: 100, imageLink: 'https://linktoimage.com/', published: true }, ... ] }

POST: /users/signup
Description: Creates a new user account. Input: { username: 'user', password: 'pass' } Output: { message: 'User created successfully' }


SOLUTION:

USER SCHEMA should be:

const UserSchema = new mongoose.Schema({
// Schema definition here
username: String,
password: String,
purchased: Array,
});

&&

POST: /users/signup
Description: Creates a new user account. Input: { username: 'user', password: 'pass' }
newUser = {
username: req.headers.username,
password: req.headers.password,
purchased: [],
}
Output: { message: 'User created successfully' }

@piyush-ramnani piyush-ramnani changed the title week-3 > 03-mongo > Readme.md | incomplete user-signup details | missing purchased property in Schema week-3 > 03-mongo > Readme.md | missing purchased property in Schema Dec 28, 2023
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

No branches or pull requests

1 participant