ITC-NTHU / LyricLab

1 stars 0 forks source link

DEVELOP 06: Presentation Layer Refactoring  #8

Open jerry914 opened 1 week ago

jerry914 commented 1 week ago
  1. Manage user sessions:

    • [x] Use cookie-based sessions to maintain any history or information about the user’s experience
    • [x] Configure Roda to use cookies to manage user sessions
    • [x] Create a hashing secret for the cookies (Use: rake new_session_secret - in Rakefile)
  2. Add error-checking to your routes

    • [x] Distinguish the steps of each route (get data from API, store data in DB, etc.) and leave simple comments in your code identifying these steps
    • [x] Check and catch errors at each step:
    • [x] Use conditional logic (e.g, if-else) to check the validity of the output of steps
    • [x] Catch (rescue) expected or unexpected errors in each step
    • [x] Display notice / error flash messages (cookie-based)
  3. Refactor your views

    • [x] Identify all the places your views use domain objects (entities/values)
    • [x] Create View Objects in your domain
    • [x] Implement the major functionality your views need
    • [x] Some view object methods might simply call the same method on domain objects
    • [x] Give descriptive names to the complex behavior
    • [x] You might have to make several view objects corresponding to smaller entities and values
    • [x] Ensure controller is only passing a view objects to views
    • [x] Refactor views (e.g., slim files) to only use view objects
  4. Deploy to Heroku

    • [ ] Merge your refactor-presentation branch into main and push both branches to Github
    • [ ] Deploy your updates to main branch on Heroku
    • [ ] Don’t forget to add a SESSION_SECRET environment variable to Heroku