gbowne1 / codebooker

This is a book recommendation app created with React 18.2 and MUI for coders/programmers looking for reccomendations to books on programming/coding to read
MIT License
31 stars 57 forks source link

[Feat] Add a feature to save books to your favorites #30

Open gbowne1 opened 1 year ago

gbowne1 commented 1 year ago

Some users may want to save books to their favorites.

May even have a side feature for users to share their favorite books with others.

I would suggest using a heart icon to:

1) add to favorite books list 2) show favorited books

Do we need to build a UI feature that will allow users to see their and/or possibly other users favorite books? My thoughts are yes.

Gourav2609 commented 1 year ago

hello @gbowne1 ....can u please assign this to me......i think i will be able to this

gbowne1 commented 1 year ago

ok @Gourav2609 I will assign you.

Gourav2609 commented 1 year ago

Thanks @gbowne1 for giving this opportunity....this is going to be my first time experience....thanks a lot.....

gbowne1 commented 1 year ago

You're welcome @Gourav2609.

Gourav2609 commented 1 year ago

@gbowne1 image can u please help me here ...i have tried it

i have created the .env file image

gbowne1 commented 1 year ago

@LOGESH-B

Any ideas? I was not able to replicate this error.

gbowne1 commented 1 year ago

@Gourav2609

I will say that the connection string in the MONGO_DB string should be:

MONGO_DB=mongodb://username:password@localhost:27017/codebooker

replace username and password with your local database password and make sure there is an : in between them

gbowne1 commented 1 year ago

I also will say that it won't work without starting the mongod server first and then using either mongo or mongosh to create the codebooker database by doing use codebooker in either mongo or mongosh. If you use MongoDB compass, MongoDB atlas or the MongoDB extension in VSCode the workflow will be a bit different. You can use whatever database name you want in place of codebooker.

gbowne1 commented 1 year ago

Well, yes and no.

The insertOne() method is not a native method of Mongoose. It is a method provided by the MongoDB Node.js driver aka mongodb package

In Mongoose, you can use the create() method to insert a document into a collection

If you want to use the insertOne() method from the MongoDB Node.js driver directly, you can access the underlying collection object using Model.collection and then call the insertOne() method on it.

We can also define a schema for a user and create a model using mongoose.model(). We then create a new document and use the create() method of the model to insert the document into the collection. The create() method returns a promise, so we can use .then() and .catch() to handle the success and error cases, respectively.

Again, Gourav2609 is running across a timer/timing problem, among another issue on top of that.

Gourav2609 commented 1 year ago

I also will say that it won't work without starting the mongod server first and then using either mongo or mongosh to create the codebooker database by doing use codebooker in either mongo or mongosh. If you use MongoDB compass, MongoDB atlas or the MongoDB extension in VSCode the workflow will be a bit different. You can use whatever database name you want in place of codebooker.

actually i was using mongoDB campass

gbowne1 commented 1 year ago

@Gourav2609

I don't think you'll need to run setup.js if you use MongoDB compass. All setup.js does is create a test user.

That can be done like this in Compass, according to some documentation.

To create a test user using MongoDB Compass, you don't need to run the setup.js file mentioned in your previous question. Instead, you can follow these general steps:

Save the user configuration. MongoDB Compass will create the user in the specified authentication database.

By following these steps, you should be able to create a test user in your MongoDB database using MongoDB Compass without the need to run the setup.js file.

Gourav2609 commented 1 year ago

thanks @gbowne1 I will try it and get back to you if I face any issues..

gbowne1 commented 1 year ago

yeah, Please do let @LOGESH-B and me know about any issues you have. He uses Atlas. I use mongod and mongosh locally in the console/terminal. I've never used Compass or Atlas so I don't know how that worflow goes, just did some reading to find out those steps.

The test user this workflow should allow you to log into the app.

Gourav2609 commented 1 year ago

Hello @gbowne1 and @LOGESH-B ,

My Progress

1. Ran MongoDB server image

2. Ran mongosh command****
image

3.Ran setup.js image

4. Ran index.js image

5. Copied username and password from users and pasted it in React App image image

Still getting this error

image

gbowne1 commented 1 year ago

@Gourav2609 that is because you copied the hash of the password into the react app. the actual password is test iirc. Looks like everything else went along fine though. It succesfully created the test user after running the setup.js.

Oh and thanks for the screenshots too. :+1: :100:

Gourav2609 commented 1 year ago

@gbowne1 thanks for the correction now i was able to open it i was thinking since i learned a lot during setup for the project ........how about me contributing to a proper documentation about setup of the project

gbowne1 commented 1 year ago

Thanks @Gourav2609! Glad that helped out. Yes the test user login information is in the User model/schema.

Yes, and you're always always welcome to work on anything you feel like working on. There is an issue for adding MongoDB Compass/Atlas #137

Any documentation go in /docs/ and also linked in the README's.

They will eventually get cross posted to the Wiki.. there is an issue for that #141

I forgot to add, that once in mongo or mongosh shell (either shell works) switch to the database using the command use codebooker to switch to using the database, and if it is not created alreadfy it will create codebooker.

Gourav2609 commented 1 year ago

@gbowne1

Getting Started With UI

image

Thinking

i was thinking of creating a similar column with a name Favourite

initially every book contains image whenever a book is added to favorites the icon changes to image

on cliking favourites

image

using same color pallets and displaying them

how do you think this would be

gbowne1 commented 1 year ago

@Gourav2609 I love the idea about changing the icon filled state when the favorite gets added.

Would clicking on Favorites in the dropdown/context menu there show all the favorited items?

We would have to figure out where to put a heart / favorite icon for actually adding the item.

I think that's great

Gourav2609 commented 1 year ago

@gbowne1

Would clicking on Favorites in the dropdown/context menu there show all the favorited items?

whenever the user navigates to favorites through profile then the user is navigated to a different page where he can view only his favorites books .

We would have to figure out where to put a heart / favorite icon for actually adding the item.

how about before review and after year columns

gbowne1 commented 1 year ago

sounds like a great idea.

gbowne1 commented 1 year ago

@Gourav2609 it's been almost a month, have you been able to get through this issue? Just checking in to see if you have made any progress.

Gourav2609 commented 1 year ago

hello @gbowne1 ....sorry not able to update you about the progress...i just got a little busy with my college things...will update soon..

gbowne1 commented 1 year ago

Ok, let me know. Am just checking in to see if you have made any progress.

akash0708 commented 1 year ago

@gbowne1 I would like to give this a go.

gbowne1 commented 1 year ago

Ok @akash0708 I will assign you

akash0708 commented 1 year ago

@gbowne1 I have been facing this error since yesterday,

image

I've run script.js, created the test user. But I'm not being able to log in

gbowne1 commented 1 year ago

the test user credentials are:

username: test email: test@gmail.com password test

Also: https://github.com/gbowne1/codebooker/blob/master/docs/DEVSETUP.md has more information, as well as the rest of this thread. If it still persists.. there might be other issues.. let us know.

@BlackBond06 @LOGESH-B

LOGESH-B commented 1 year ago

Hii @akash0708 Feel free to ask if you encountered any issue.🤝

akash0708 commented 1 year ago

Hey @gbowne1 , sorry I had my exams. But I'm finally done with them, and will start working on the issue right from today, will keep you updated. Thank you for your patience!