James-Lycett / workplace-wellness

0 stars 0 forks source link

User authentication and some db changes #67

Closed James-Lycett closed 2 weeks ago

James-Lycett commented 3 weeks ago

This contains a lot of major changes so I thought it would be smart to create a separate branch for it. This branch contains all of the changes in pull request #64 so I'm going to close that request to avoid any mishaps that merging both might cause. Additionally, this pull request addresses issues #28 and #66 but also includes some other changes such as the wholesale removal of certain middleware functions that weren't being used.

I understand there's an intimidating number of changes listed below lol it'll probably be way easier for me to run you through all this stuff live rather than you trying to interpret it alone, but you can at least test it on your machine.

Steps to Test:

  1. Add 'API_SECRET_KEY=296319b8f01c96abd170a5f29f18d288385f3846c956f0ad30c8b089a6029c0b' to backend/.env

  2. From backend directory:

    • npm i
    • npx knex migrate:rollback
    • npx knex migrate:latest
    • npx knex seed:run
    • Keep in mind that this will restructure your databases so if you try to run backend code from another branch it will fail until you rerun the migrations and seeds present in that particular branch
  3. Create a new user and/or sign in to a user passwords for all seeded users are that user's userId

  4. Make sure the dashboard loads up correctly and that everything functions correctly (LOG NEW ACTIVITY, Add a New Employee, "Edit" button on employee cards, and "X" delete employee button)

  5. Try accessing a dashboard for a different user (one that isn't logged in) and verify that you are redirected to login page

Changes: backend

frontend

James-Lycett commented 3 weeks ago

Added:

cozyfestiv commented 2 weeks ago

Amazing work! This is so cool.

Had to create and then delete a migration file to get rid of that weird "users" table and added some logic that makes rollbacks on the migrations a little smoother with the foreign key stuff