wavesinaroom / my_odin_project_dance_school

Dance school booking system with Express.js
0 stars 0 forks source link

Admin controller #3

Open wavesinaroom opened 12 months ago

wavesinaroom commented 12 months ago

Admin controller perform the following actions by admin user:

  1. Create lessons
  2. Delete lessons
  3. Add student
  4. Remove student
  5. Add students to lessons
  6. Remove students from lessons
  7. Resets students password
wavesinaroom commented 11 months ago

The model-view-controller flow is working now but there are a couple of things to improve:

wavesinaroom commented 11 months ago

Admin can delete lessons by clicking on a delete button next to each lesson rendered details. So, for this features I need to work on:

1 Render existing lessons as a table with rows and columns 2 Add a delete button nex to each rendered lesson.

Optionally, I'll add a confirmation panel to help admin prevent mistakes.

wavesinaroom commented 11 months ago

Lessons deletion is ready but I discovered routes weren't working properly. The bug happened when browsing between create and delete sections. This is not hard to fix fortunately, apparently I only need to to change the way urls are generated in delete and create lessons views and routes.

On the other hand, the style field in the create section stops lesson creation because for validation throws and error when the input consists of two or more words.

wavesinaroom commented 11 months ago

I didn't have much trouble coding the student deletion feature. I'd like to improve it with a specific confirmation message but that will come later. I'm doing that because I can't spend much time on adding details so this improvement will go to my mental backlog.

wavesinaroom commented 11 months ago

When rendering lessons for booking for a student I immediately noticed that number of spots and available spots number were the same. I feel the bug is in the lesson creation function inside the controller.

wavesinaroom commented 11 months ago

I learned how to add elements to array in documents and increase values in document fields. There's just a problem with booking lessons which is students being able to book the same lesson more than once.

wavesinaroom commented 11 months ago

I wished I could implement flash messages to give users more info about booking lessons exceptions. That's not possible just now because connect-flash needs express sessions and that will come later when admin and students features are ready. For now, I'm notifying errors with res.send() till I'm coding sessions and passwords.

wavesinaroom commented 11 months ago

Admin controller is currently at a really good functioning state. There's only one flaw that I want to improve when I'm done with the student controller that is flash messages. If they are implemented, the overall user experience on exceptions will be much better because users could get feedback on those fields that need amendment. Aside for that that branch is ready for merging.

wavesinaroom commented 11 months ago

UX is enormously improved with user feedback prompted on errors.