Skip to content

Notes on Backend

Shidan Javaheri edited this page May 12, 2023 · 6 revisions

Util Classes 🔨

This project uses Util classes to avoid repeated code and make methods as easy and succinct as possible! Find out what util methods are available here

Database Util 🔩

This class contains a method to clear the database for testing, as well as methods to create and save every object type to the database. Feel free to add more to it and document them here!

  • clearDatabase
  • createAndSaveAccount
  • createAndSaveItem
  • createAndSaveTheme
  • createAndSaveSource
  • createAndSavePracticeSession

DTO Util 🔩

This class contains methods to create DTO objects from their non DTO versions

  • convertAccountToDto

Exception Handling 🪚

Our Application uses Springs Global exception handler to throw a custom exception called a GlobalException. This exception contains both a message and an Http Status. The exception is used as follows:

  • Service methods, which handle the business logic of the application, throw GlobalExceptions with the appropriate message and Http Status. For the most part, they are the only methods that throw these exceptions, though Controller methods may do so in rare cases too

  • Controller methods call service methods, but do not need to worry about exception handling - therefore, there are no try / catch blocks. Exceptions that bubble to the surface are handled completely by Spring

Clone this wiki locally