Hellow NS8. This is my submission for the technical assessment for the backend. My apologies for not getting all parts finished.
My plan of attack went as such:
- Get an express app up and running utilizing Typescript.
- Stub out routes for activity and user endpoints.
- Creation of middleware for logging. (You'll see in my middleware a comment about how I first started thinking this was logging of all activities, but in re-reading I figured out this was not the case. Time wasted.)
- Create User class in Typescript
- Create User store
- Finish endpoints for User creation, edit, and delete.
- Create get activity endpoint - Unfinished
- Create activity store - Unfinished
I thought I had for the longest time thought my store was broken and always instantiating a new store at every call, even though it was a simple error right before insert of a new user.
In current projects I've worked with, I've standardized route(controller) responses. They are Typescript interfaces like IUserResponse that always have 'success: boolean', 'message: string' and then what would have been 'user: User' and 'users: User[]'. It helps force the practice of sending appropriate error messages and why. And handling edge cases.
I have used both date-fns and moment to handle time comparisions. I do feel comfortable on filtering arrays with dates in them on actions.
Thanks for taking a look at this, the four hours went fast for me. Wanted to show you what I was able to get done in that time.