Movies API - Querying and mutating data on DynamoDB through GraphQL #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Interview Solution Submission
Candidate Name: Arthur Bassotto Ziero
Interview Date: May 19th
Solution Overview
The solution emphasizes clear separation between layers (resolvers, services, DTOs) and uses validation to ensure data integrity.
It implements five core functionalities:
While I didn't have much prior experience with NestJS, GraphQL, or DynamoDB, I drew from my background in structuring large-scale projects to focus on building a clean and concise solution.
Key Implementation Details
Technologies/Languages Used:
Main Components/Files Modified:
Built CRUD operations using NestJS services and GraphQL resolvers with input validation with class-validator. For querying the highest rated movies, I've used GSI instead of normal scan as this is a more efficient way of fetching data.
Testing & Validation
I did ad hoc testing. I focused on solving the most basic cases, like making sure a movie existed before updating it. In a real scenario, automated testing would not only be helpful but, a necessary step to make sure the code meets the quality standards
Time Spent
Approximately 4 hours for the coding plus 20 minutes for this PR.
Additional Notes
There are two main points regarding the Separation of Concerns, that I'd love to improve if I had more time:
1. Database Gateway with dependency injection
I would create a gateway between the DynamoDB client and the service layer to make our code database-agnostic. We could define an interface to specify the expected type in our service, and through dependency injection, let Nest inject the gateway implementation using DynamoDB into the service.
2. Domain objects and object mappers
In the code I delivered, the layers are well-defined (service, resolvers, DTOs), but for a large project, it would be important to create domain objects and object mappers. This approach allows the business logic layer to communicate using domain objects rather than directly using entity representations. To achieve this, a domain entity mapper would need to be implemented to translate domain objects into entities and vice versa.
Submission Confirmation
Demo
I've attached this video with the project running locally. You can check for more information on how to run the project locally on my README.
MovieAPI-GraphQL-Demo.mp4
Ready for Review: Please review my submission
@ericcheatham
@damonique-dev
Thank you for your time and consideration. I look forward to discussing this solution with you.