chaynHQ / bloom-backend

Code for the backend / API of the Bloom service
https://bloom.chayn.co/
MIT License
17 stars 29 forks source link

Refactor use of getUserDto schema between functions #453

Open annarhughes opened 3 months ago

annarhughes commented 3 months ago

Is your feature request related to a problem?

Most of our backend api requests are related to users, so before the request function is run, we get the current user from the database and make the user data available in the request and following functions. The problem is that we are passing around the user data in a serialized schema GetUserDto and instead we should be using the pure UserEntity schema/types, for all internal functions. GetUserDto schema should only be used to serialize user data before returning the response, i.e. in the controller

Describe a solution:

This is the first step (see #454) in improving the maintainability and performance of the API and how it handles users. The cleaner typing will help future contributors understand the code!

Additional context and resources:

Tests may need to be fixed following this update - run to check failing tests

Ticket breakdown

547

546

545

eleanorreem commented 1 month ago

I am going to break this down into bitesized chunks as I think this refactor will be too mammoth on its own. I have linked above