gbowne1 / RadioLogger

A Radio Logging application build with NodeJS and ExpressJS
GNU General Public License v3.0
6 stars 6 forks source link

[TODO] User Profile - Add/Edit profile #70

Open gbowne1 opened 11 months ago

gbowne1 commented 11 months ago

I added a new profile page to the app at /profile

There is currently no way for a logged in user to create, edit or otherwise update their profile

They should be able to CRUD any part of their profile and the new or updated information should be saved to the mongoose/mongodb database/ collection(s).

There should also be some method for users to see the other users profiles registered on the app and to like, follow, share, etc. those users.

Pulkitxm commented 11 months ago

Can I get assigned? let me know how to start.

Joywin2412 commented 11 months ago

Hey! I am ready to work on this issue. I'll do the get request for others users profile pages and also update the user model to have likes on their page. Could you assign me this issue?

gbowne1 commented 11 months ago

Ok @Joywin2412

Joywin2412 commented 11 months ago

I have worked on the issue. Do review it.

gbowne1 commented 11 months ago

I forgot. In order to see the profile you have to go to: http://localhost:3000/profile/profile.html as going to http://localhost:3000/profile alone does not work.

@Joywin2412 @jzunigarce

Joywin2412 commented 11 months ago

Okay , do you want me to fetch the html file whenver someone does a get request on the given route /profile/profile.html just to be sure? @gbowne1

gbowne1 commented 11 months ago

@Joywin2412 I think it should be /profile in the browser's address bar instead of the full URI/URL of /profile/profile.html even though the server sends the html file from the public folder.

This happens with dashboard too. In order to actually see the dashboard you have to navigate to /dashboard/dashboard.html as /dashboard alone won't work. Probably why we aren't redirecting to /dashboard after successful login. The redirecting path might need to be the full path not just /profile or /dashboard.

Joywin2412 commented 11 months ago

Okay then , I got it. I'll change the controllers code of profile. Whenver someone makes a get request to the /profile, the server will respond with profile.html file.

gbowne1 commented 11 months ago

I also noticed that the only thing we have is the profile.controller.js

There's no service, middleware etc.

Joywin2412 commented 11 months ago

Yes , we don't have profile.html. Should I leave it or make a profile.html file?

gbowne1 commented 11 months ago

There is a profile.html

It's in/profile/profile.html in the client side folder(s)

gbowne1 commented 11 months ago

We also have profile.js in the scripts on the client side folder(s)

Joywin2412 commented 11 months ago

Okay got it

gbowne1 commented 11 months ago

It will load if you navigate to http://localhost:3000/profile/profile.html. it won't work if you go to http://localhost:3000/profile

Joywin2412 commented 11 months ago

I have made the changes in the client side routing. I have also made some changes in server.js because of problems I had to face while running the server on my machine. Do review it @gbowne1

gbowne1 commented 11 months ago

Any reviews you want make sure you add me to and @jzunigarce to the PRs as reviewers as we are both maintainers. I will review this.

Just so you know, Both the api v1 and the web api need the same changes.

A service and middleware for the profile will have to be created in their respective folders.

Joywin2412 commented 11 months ago

I didn't get the statement "A service and the middleware for the profile will have to be created". The issue is completed right or do I have make more changes?

gbowne1 commented 11 months ago

Yes it's complete. I think it's fine the way it is and it works.

Typically as you see we have controller, middleware, router and a service for each of the functionality. We originally had a huge server.js file.

The API v1 and the Web API hasn't been documented yet.

Joywin2412 commented 11 months ago

Okay got it. Please do close this issue as completed 🚀

gbowne1 commented 11 months ago

@Joywin2412 as far as the actual issue in this issue thread, now that the profile routes correctly, is to create a means of editing the profile if the user is logged in and has the correct permissions, etc.

In the dashboard and all of the other pages in the app like /scanlog, /vhflog, /hamlog, /mwlog you should be able to click on the user icon / avatar and click on the profile in the dropdown that appears and it should show the profile page.

Joywin2412 commented 11 months ago

Okay , I understood the underlying issue. I think I'll unassign myself and someone else take up the work. I am not sure how to solve the navigation of routes.

gbowne1 commented 11 months ago

@Joywin2412 sorry for the confusion if there was any. You were able to get the profile routing correctly. That's great all by itself The profile itself needs some more work. We still need to document the APIs.