Skip to content

Latest commit

 

History

History
152 lines (105 loc) · 5.84 KB

LESSONPLAN.md

File metadata and controls

152 lines (105 loc) · 5.84 KB

Entry Ticket

Please take a moment to reflect on what you have previously learned and hope to learn by completing this Google Survey. Remember your responses will be read by your instructor to help guide future lessons.

Daily Resources

Slack Message

@channel For the Java class today, I will start from the application found in https://github.com/BloomInstituteOfTechnology/java-usermodel/tree/master/usermodel_initial. So, you will need copy of this in order to follow along! The Java Class will be starting in 3 minutes at (https://lambdaschool.zoom.us/j/#########) Please post questions to the Slido link at (https://app.sli.do/event/XXXXXXXX)

Introduction and Hook

When was that user added? Who changed that restaurant's phone number? Can I get of count of restaurants by state?

These real questions that our data should be able to answer. In this guided project, we will learn how to answer those questions and more!

Purpose

Today we add some important features to our CRUD Application:

  • Audit Fields, who did what when?
  • Custom Reports - I want THAT data!
  • Improve our handling of many to many relationships.

Learning Activities

Working with objective: Add additional fields to a Many to Many Join Table

  • Split Many to Many to 2 One to Many Relationship

    • Add models.UserRoles
    • Models - remember to add new getter and setter and remove old ones
    • Update Services to adapt
      • This especially affects UserServiceImpl
    • Update SeedData to use UserRole
    • Need to update how roles are sent in JSON
    • Controllers do not change!!!
  • Check for Understanding CFU - Google Form

Working with objective: Add standard auditing fields to each table

Working with objective: Populate and display standard auditing fields

  • Run the application

    • Show how the fields are in the tables using H2Console
    • Show how the fields are not in the JSON output by surfing to http://localhost:2019/useremails/useremails in Postman
      • No getters so no fields in JSON!
      • Add getters to Auditable and run again
        • Now you see all the audit fields!
        • If you want audit fields on just a single table,
          • DO NOT add to Auditable.
          • Just add them to the table you want them!
            • These have to be manually typed in and cannot be generated
            • There is one commented out in models.Role
  • Check for Understanding CFU - Google Form

Working with objective: Use SQL, JPA and Hibernate to perform custom query operations on a RDBMS through a Spring Application

  • Add Custom Query Reading (views.UserNameCountEmails)

    • Add views.UserNameCountEmails
    • Add UserRepository.getCountUserEmails
    • Add UserController.getNumUserEmails
    • Add views.JustTheCount - needed for later. Explain how this is a general count interface and can be used for multiple counts
    • Add UserRepository.checkUserRolesCombo
  • Check for Understanding CFU - Google Form

Working with objective: Use SQL, JPA and Hibernate to perform custom data manipulation operations on a RDBMS through a Spring Application

  • Add features to work with Roles

    • UserController.deleteUserRoleByIds
    • UserController.postUserRoleByIds
    • UserService.deleteUserRole + implementation
    • UserService.addUserRole + implementation
    • UserRepository.deleteUserRoles
    • UserRepository.insertUserRoles
  • Check for Understanding CFU - Google Form

Objectives to Cover if Time Permits

Working with objective: Implement default Swagger Documentation

Working with objective: Print the default Swagger documentation

Review JPA Advance Queries

  • Review - add find user emails from username
    • Add UseremailController.findUseremailByName

Closing

Conclusion

Review what we just learned

  • Improved handling of Many To Many Relationships
  • Added Auditing fields to all our tables
  • Added custom queries to our application
  • Added Swagger Documentation

How is this related to tomorrow's topic

  • We added to the functionality of our CRUD Application
  • We will continue adding functionality until we have a production ready application!

Exit Ticket

Please take a moment to reflect on what you have learned in today's Guided Project. Remember your response will be read by your instructor to help guide future lessons.